instruction
stringlengths
0
30k
I am working on a project in Mercurial with CMake in Windows Visual Studio 2022. CMake reruns every time I swith from one revision to another, which changes CMakeLists.txt, and a very time costly build follows. Could one explain please how CMake decides the time passed to rerun? Does cmake rerun always mean regenerating all the Makefiles? How to prevent the mass compilations?
How to prevent CMake rerun after Cmake changed?
|cmake|compilation|mercurial|revision|cmakelists-options|
null
In v5 the default value for the `Button` color prop changed from `default` to `primary`. So in v5 the following two buttons are identical (apart from the text in them): ``` <Button variant="contained" color="primary">Primary</Button> <Button variant="contained">Grey</Button> ``` The easiest way I see to get back to the v4 behavior is to use `color="inherit"` for the buttons that were previously using `color="default"` (either explicitly or implicitly via absence of the color prop) and change your style overrides to target `containedInherit` instead of `contained`. ``` import * as React from "react"; import ReactDOM from "react-dom"; import { StyledEngineProvider, createTheme, ThemeProvider, } from "@mui/material/styles"; import Button from "@mui/material/Button"; const theme = createTheme({ components: { MuiButton: { styleOverrides: { containedInherit: { backgroundColor: "grey", }, }, }, }, }); ReactDOM.render( <StyledEngineProvider injectFirst> <ThemeProvider theme={theme}> <Button variant="contained" color="primary"> Primary </Button> <Button variant="contained" color="inherit"> Grey </Button> </ThemeProvider> </StyledEngineProvider>, document.querySelector("#root") ); ``` [![Edit Mui v5 ovverides (forked)](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/mui-v5-ovverides-forked-wff7cg) Related documentation: - https://mui.com/material-ui/migration/v5-component-changes/#%E2%9C%85-remove-default-color-prop
|swiftui|swiftui-list|
The apk needs to be zipaligned with parameter '4' for this specific purpose. If an external apk is used, then zipalign must be done manually or else the .so file inside the apk will refuse to load because of the wrong alignment. Even though you might think that the gradle build of you app already did a zipalign, that zipalign might not be aligned to the offsets required. If zipalign does not solve the issue, then check Android source code: bionic/linker/linker.cpp, function open_library_in_zipfile() which might give you more clues why the library is not loaded.
**CONTEXT:** I have a component called GenericTable which receives an Enumerable of T (classes) and displays it in a [table][1]. Every column comes with 2 buttons one for update and inactivate which are eventcallbacks. This is the razor code (I'll try to paste the part where the problem is produced I don't want to flood this question with code) ``` <tbody> @if (EnumList is not null) { @foreach (var item in EnumList) { <tr> @foreach (var prop in typeof(T).GetProperties()) { string propVal = ""; if (Props.Contains(prop.Name)) { <td>@prop.GetValue(item)</td> } else { continue; } if (prop.Name == PropValue && PropValue is not null) { propVal = prop.GetValue(item)!.ToString()!; bool itemLoader = false; <td> <TelerikButton Icon="@FontIcon.Pencil" OnClick="() => GetPropValue(propVal, itemLoader)" Enabled="@(!itemLoader)"> @(itemLoader ? "Actualizando": "Actualizar") <TelerikLoader Visible="@itemLoader"/> </TelerikButton> </td> <td> <TelerikButton Icon="@FontIcon.Cancel">Inactivar</TelerikButton> </td> } } </tr> } } else { <div class="spinner-border text-primary" role="status"> <span class="visually-hidden">Loading...</span> </div> } </tbody> ``` As you can see in second If statement I'm using a local scope variable called itemLoader which is a bool variable that is used to trigger the Loader effect all of this is done with the GetPropValue method which takes the value of prop value (property) I'm passing and the value of itemLoader which in this case is false. You can see here the code behind of this component to see how this method behaves. ``` public partial class GenericTable<T> where T : class { [Parameter] public IEnumerable<T> EnumList { get; set; } [Parameter] public IEnumerable<string> Props { get; set; } [Parameter] public EventCallback<string> ButtonClicked { get; set; } [Parameter] public string? PropValue { get; set; } async Task GetPropValue(string propValue, bool itemLoader) { itemLoader = true; await ButtonClicked.InvokeAsync(propValue); itemLoader = false; } } ``` Pretty simple when I click on the button the itemLoader is set to true and then to false. **WHY IM DOING IT THIS WAY:** Well before itemLoader I used to have a global variable called Loader in my code behind so everytime I click a button the GetPropValue method will set it to true, the thing doing it with a global varibale is that every button will trigger the loader effect as you can see even though is not the final result I wanted to achieved the global variable will work. [![Loader ][2]][2] **THE PROBLEM:** So now with the new approach I'm using with itemLoader for some reason it doesn't want to render the Loader effect and it's seems weird to me becuase I've tried to debug to see how the variable is behaving and the GetPropValue method sets the itemLoader to true in second If scope [![Debug1][3]][3] [![Debug2][4]][4] But it doesn't render the the effect. **WHAT I'VE TRIED:** I did add StateHasChanged() to the GetPropValue method but that didn't work. **NOTE:** I don't know if this useful but this is where I'm using my component [![Component][5]][5] and this the UpdateDept method ``` async Task UpdateDept(string deptId) { try { ca_dept = await _ca_dept_Repository.Get(x => x.zdept_id == deptId); await _synchronization.updateDepartment(ca_dept!); displayAlert = true; displayMessage = $"El departamento {ca_dept!.name} fue actualizado."; displayAlertType = Alert.AlertStrings.Success; StateHasChanged(); await Task.Delay(2000); displayAlert = false; displayMessage = default!; displayAlertType = default!; StateHasChanged(); } catch (Exception ex) { displayAlert = true; displayMessage = $"El departamento {ca_dept!.name} no pudo ser actualizado, hubo un error: {ex.Message}."; displayAlertType = Alert.AlertStrings.Error; StateHasChanged(); await Task.Delay(2500); displayAlert = false; displayMessage = default!; displayAlertType = default!; StateHasChanged(); } } ``` [1]: https://i.stack.imgur.com/SwGza.png [2]: https://i.stack.imgur.com/OQWqA.png [3]: https://i.stack.imgur.com/gU4XS.png [4]: https://i.stack.imgur.com/llAbX.png [5]: https://i.stack.imgur.com/QMXbM.png
Bool value is not triggering loader Blazor
|c#|.net|razor|blazor|
I have a list with json data filled in `GetListView()` view. now i am showing this list in SecondView. here i want to show the GetListView from white view bottom to screen bottom to 20. but i can able to give only height: 500 for the GetListView.. i want it should be bottom to 20 of the screen **How to show list upto bottom to 20 in `SecondView`** and please guide me if i used any unnecessary code **GetListView code:** here how to remove the line b/w cells and the topspace struct GetListView: View { @StateObject var getData = GetServiceViewModel() var body: some View { VStack(){ Text("Friends List") List(getData.dataRes?.data ?? [], id: \.id ){ item in ZStack (){ Color.yellow HStack(alignment: .top){ AsyncImage(url: URL(string: item.avatar), content: { image in image.resizable() }, placeholder: { ProgressView() Text("Load..") }) .padding(.leading, 15) .padding(.top, 10) .scaledToFit() .frame(height: 70) VStack(alignment: .leading, spacing: 5) { Text(item.firstName) Text(item.email) Text("description shjfgds fgds gf dsgf gds fyg dsygf ydsg fgyds gf ydsg fgyds gf dsy fgyds fgyd s...") .padding(.bottom, 15) HStack(spacing: 15){ Spacer() Text("12/3/2024") .foregroundColor(Color.green) Text("New") .foregroundColor(Color.green) } Button("TestButton") { print("index of list \(item)") } } .padding(EdgeInsets(top: 10, leading: 5, bottom: 5 , trailing: 10)) Spacer() } } .cornerRadius(20) .padding(.bottom, 10) .listRowBackground(Color.clear) .listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) .contentShape(Rectangle()) tappable .background( NavigationLink(destination: ThirdView(seltData: item)) { EmptyView() } .opacity(0) ) } .task{ getData.postAndGetGenericCall(completion: { print("Data loaded: \(String(describing: getData.dataRes?.data))") }) } .background(Color.red) } } } **SecondView code:** struct SecondView: View { var body: some View { ZStack { ScrollView { VStack { HStack { VStack { HStack(alignment: .top) { Image(systemName: "person.circle.fill") .resizable() .aspectRatio(contentMode: .fit) .modifier(ImageModifier(width: 70, height: 79)) .padding(.top, 10) Rectangle() .background(.red) .frame(width: 5) } } .frame(maxHeight: .infinity, alignment: .top) VStack(spacing: 10) { Group { Text("Jhon Thomas") .padding(EdgeInsets(top: 0, leading: 10, bottom: 10, trailing: 0)) .font(.system(size: 20)) RowItem(text: "000000000", icon: "phone.fill") RowItem(text: "Singer", icon: "bag.fill") } .frame(maxWidth: .infinity, alignment: .leading) HStack { RowItem(text: "Jhon Thomas", icon: "location.fill") Spacer() RowItem(text: "Jhon Thomas", icon: "map.fill") } } .frame(maxWidth: .infinity, alignment: .leading) } .padding() .frame(height: 200) .background(.white) .frame(maxWidth: .infinity, alignment: .leading) GetListView() .frame(height: 500) } .padding() } } .background(.red) } **How to show list upto bottom to 20 in `SecondView`** please guide o/p: Swift Ui is weird :( it taking its own spaces and padding not able to give required constraints. i can able to catch the coding but when it comes to UI part it is so difficult for me to understand. [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/7Yu3A.png
Swift UI design issues
|swift|list|swiftui|design-patterns|
Depends on the JSON Schema version used which you didn't indicate, AJV defaults to draft-07 with the `import` statement you are using Couple things: - Your schema definition is partially ignored because you can't have siblings to a `$ref` in older draft versions of JSON Schema. So the `$ref` defined with `baseResponseProperties` is validated but the `BAR` schema is ignored, thus why you're not returning the expected error. Try this. ```js export const featuresSchema = { allOf: [ { $ref: 'customDefinitions#/definitions/baseResponseProperties' }, { type: 'object', properties: { BAR: { type: 'array', items: { $ref: 'customDefinitions#/definitions/BAR' } } }, required: ['BAR'] } ] }; ``` The second issue is `FOO` is only defined with `type: ['object', 'null']` and you have an `items` keyword defined. These `items` will never be evaluated because you are constraining the schema to only the two defined types. ```json #invalid FOO: { type: ['object', 'null'], items: { $ref: customDefinitions#/definitions/FOO' } }, ``` ```json #valid // add array type FOO: { type: ['object', 'null', 'array'], items: { $ref: customDefinitions#/definitions/FOO' } }, OR // as an object FOO: { type: ['object', 'null'], $ref: customDefinitions#/definitions/FOO' }, ```
ok, heres whats wrong with your code 1. after assigning the srcObject of a video element you have to call play 2. in the setInterval function you get the image data in your let statement but you havent drawn anything to the canvas yet, although it would be available in the second iteration 3. when you actually invoke face(4) you do not pass the r variable through to the then function, hence when you use it in the while statement its not defined <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> 'use strict'; var timer; var stream; document.querySelector('input[value=stop]').onclick = e=>{ clearInterval(timer); if(stream)stream.getTracks().forEach(track=>track.stop()); } try { const w = window, d = document, ng = navigator, id = e => { return d.getElementById(e) }, cn = id('lh'), i = id('i'), o = id('o'), cx = cn.getContext('2d', { willReadFrequently: true }), face = r => ng.mediaDevices.getUserMedia({ video: {width:100,height:100} }).then(s => { stream=s; i.srcObject = s; i.play(); i.onloadedmetadata = e => { timer=setInterval(() => { let c = 0, k = -4, h = cn.height = i.videoHeight, w = cn.width = i.videoWidth; cx.drawImage(i, 0, 0, w, h); let dt = cx.getImageData(0, 0, w, h), io = dt.data, dl = io.length, R, G, B; R = G = B = 0; o.src = cn.toDataURL('image/webp'); var r = 4; while ((k += r*4) < dl) { ++c; R += io[k]; G += io[k + 1]; B += io[k + 2] }; ['R', 'G', 'B'].forEach(e1 => { eval(e1 + '=' + `~~(${e1}/c)`) }); let rgb = `rgb(${R},${G},${B})`; d.body.style.background = rgb }, -1) } }); face(4) } catch (e) { alert(e) } <!-- language: lang-css --> canvas { border:1px solid lightgray; } video { border:1px solid lightgray; } img { border:1px solid lightgray; } input { font-size:16px; padding:5px; } <!-- language: lang-html --> <canvas id=lh></canvas> <video id=i></video> <img id=o> <input type=button value=stop> <!-- end snippet --> i added a stop feature so it can be turned off with reloading the page im afraid that it wont actually run in the stackoverflow website, i think they must have webcam access turned off and wont allow video to play ive created a much neater version for anyone who visits this page at a later date, it needs a canvas element and its derived 2d context var stream = await navigator.mediaDevices.getUserMedia({video:true}); var video = document.createElement('video'); video.srcObject = stream; video.play(); (function update(){ ctx.drawImage(video,0,0,canvas.width,canvas.height); var img = ctx.getImageData(0,0,canvas.width,canvas.height); var n = img.data.length; var r = 0; var g = 0; var b = 0; for(var i=0;i<n;i+=4){ r += img.data[i]/n*4; g += img.data[i+1]/n*4; b += img.data[i+2]/n*4; }//for document.body.style.background = `rgb(${r},${g},${b})`; if(abort)return; requestAnimationFrame(update); })(); i thought this was a nice little project so ive added a working example, i dont think a lot of these sites that allow code generation allow video, anyway heres what all the fuss is about <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> var ctx = canvas.getContext('2d'); var balls = ballsmod(10); var abort = false; var framerate = 20; document.querySelector('input[value=stop]').onclick = e=>abort = true; (function update(){ ctx.clearRect(0,0,canvas.width,canvas.height); balls(); var data = ctx.getImageData(0,0,canvas.width,canvas.height); var n = data.data.length; var r = 0; var g = 0; var b = 0; var s = 4; for(var i=0;i<n;i+=4*s){ r += data.data[i]/n*4*s; g += data.data[i+1]/n*4*s; b += data.data[i+2]/n*4*s; }//for document.body.style.background = `rgb(${r},${g},${b})`; if(abort)return; setTimeout(update,1000/framerate); })(); function ballsmod(num){ var cols = ['blue','green','red','yellow','lightblue','lightgray']; var balls = []; for(var i=0;i<num;i++)balls.push(ball()); function update(){ balls.forEach(update_ball); }//update function rnd(size,offset){return Math.random()*size+(offset||0)} function ball(){ var col = cols[parseInt(rnd(cols.length))] var r = rnd(20,20); var x = rnd(canvas.width-2*r,r); var y = rnd(canvas.height-2*r,+r); var dx = rnd(20,-10); var dy = rnd(20,-10); var ball = {x,y,r,col,dx,dy,update}; return ball; }//ball function update_ball(ball){ ball.x += ball.dx; ball.y += ball.dy; if(ball.x-ball.r<0 || ball.x+ball.r>canvas.width){ ball.dx *= -1; ball.x += ball.dx; } if(ball.y-ball.r<0 || ball.y+ball.r>canvas.height){ ball.dy *= -1 ball.y += ball.dy; } ctx.beginPath(); ctx.arc(ball.x,ball.y,ball.r,0,2*Math.PI,false); ctx.fillStyle = ball.col; ctx.fill(); }//update return update; }//ballsmod <!-- language: lang-css --> body { text-align:center; } canvas { border:1px solid lightgray; } input { font-size:16px; padding:7px; margin-left:10px; vertical-align:top; } <!-- language: lang-html --> <input type=button value=stop> <canvas id=canvas></canvas> <!-- end snippet --> [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_NOT [2]: https://stackoverflow.com/questions/22003491/animating-canvas-to-look-like-tv-noise
You are adding the view to the cell directly and setting the constraints on the contentView. When you add the view to the content view it will work as expected, so looking at your code if we only have to change the 4th line to `contentView.addSubview(view)` like so it would become: let controller = UIHostingController(rootView: SomeSwiftUIView) let view = controller.view! view.translatesAutoresizingMaskIntoConstraints = false contentView.addSubview(view) NSLayoutConstraint.activate([ view.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), view.topAnchor.constraint(equalTo: contentView.topAnchor), view.trailingAnchor.constraint(equalTo: contentView.trailingAnchor), view.bottomAnchor.constraint(equalTo: contentView.bottomAnchor) ]) Apple also suggests to add the content of a cell into the content view and not directly into the view of the cell. [See docs][1] [1]: https://developer.apple.com/documentation/uikit/uicollectionviewcell/1620133-contentview
|vba|ms-project|
Can out-of-order execution of CPU affect the order of new operator in C++?
I've read a lot of articles and guides online stating that I need to install this [npgsql program](https://github.com/npgsql/Npgsql/releases) in order to connect Power BI to a PostgreSQL database. Unfortunately none of them provide instructions on how to actually install it. On the website there are two zip files that come with no installer, so I have no idea how to actually install it. From the PGAdmin website their instructions are in programming languages that I don't understand. Can anyone please help me out on how to actually install this and connect my database to Power BI and not just send me a link to another website? I only know SQL, I don't have any knowledge of any programming language. I've tried reading every search result on how to setup this up or install and I can't figure it out.
Error **net::ERR_CONNECTION_RESET** error while uploading files to AWS S3 using multipart upload and Pre-Signed URL
|amazon-web-services|amazon-s3|next.js|connection-reset|
null
Instead of using `openai.Completion.create()`, you need to instantiate a client object using `client = openai.OpenAI()` and then utilize `client.chat.completions.create()` method for generating completions. Here's an example which shows how you can do it (taken from official OpenAI [documentation][1]): ```python from openai import OpenAI client = OpenAI() completion = client.chat.completions.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."}, {"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."} ] ) print(completion.choices[0].message) ``` [1]: https://platform.openai.com/docs/quickstart?context=python
I'm using a custom Select component in a React application, which includes SelectValue and SelectItem components. I want to change the font weight of the SelectValue component to bold when a SelectItem is selected. For example, a user clicks the "TO:" option in the dropdown, so the placeholder of the SelectValue component changes from "Select" to "TO:"; I need the font of the placeholder to change from normal to bold in this case. Here's a simplified version of my code: ``` import { useState, useEffect } from 'react'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "src/components/ui/select"; export const LinkCard: React.FC = () => { const [isSelected, setIsSelected] = useState(false); useEffect(() => { console.log('isSelected:', isSelected); }, [isSelected]); return ( <Select> <SelectTrigger> <SelectValue key={isSelected.toString()} placeholder="Select" style={{ fontWeight: isSelected ? 'bold' : 'normal' }}/> </SelectTrigger> <SelectContent position="popper"> <SelectItem value="filterTo" style={{ fontWeight: 'bold' }} onClick={() => { console.log('SelectItem clicked'); setIsSelected(true); }}>TO:</SelectItem> {/* other SelectItem components */} </SelectContent> </Select> ); }; ``` I'm using a useState hook to keep track of whether a SelectItem has been selected, and I'm trying to use this state to change the font weight of the SelectValue component. However, the onClick handlers on the SelectItem components are not being triggered, so the isSelected state is not being updated. I've tried adding onClick and onChange handlers to the Select component, but I get a TypeScript error saying that these props do not exist on the Select component.
How to change the Font Weight of a SelectValue component in React when a SelectItem is selected?
|reactjs|node.js|select|fonts|dropdown|
null
`setTimeout` creates a new macrotask queued into the event loop after the timeout, so your promises are queued in different macrotasks and have no relation at all.
Indeed, the redirection URL is not specified in some DOM element in your case. It gets fetched by JS from 'https://services.tmmumbai.in/BotService/fetchUrl?productCode=XXX' on element click.<br> You have to pass the code of the desired product instead of the 'XXX'. <br> But the product code is not specified in the DOM either. It looks like you can extract it from the img src.<br> Here is the code that worked for me, but it needs to be tested on different inputs: import re import requests from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait def get_product_url(product_code): r = requests.get(f"https://services.tmmumbai.in/BotService/fetchUrl?productCode={product_code}") return r.json()["URL"] def SCHLproject(driver, query, timeout=10): driver.get(f"https://www.truemeds.in/search/{query}") els = WebDriverWait(driver, timeout).until( EC.visibility_of_all_elements_located((By.XPATH, "//p/following-sibling::div//div/img")) ) urls = [] for el in els: src = el.get_attribute("src") re_res = re.search(r"ProductImage/([^/]+)/", src) if re_res: product_code = re_res.group(1) else: raise RuntimeError(f"Product code is not found in the img src: {src}") urls.append(get_product_url(product_code)) return urls chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-gpu") driver = webdriver.Chrome(options=chrome_options) try: print(SCHLproject(driver, "naxdom")) finally: driver.quit() Please note that I've changed the locator to XPath, using classes like 'sc-452fc789-2 eIXiYR' may be tricky sometimes, as such IDs are often generated automatically by the frontend frameworks, which means they may be easily changed. <br>Suggested XPath also can't be called a 'reliable' locator, but it is definitely better than dynamic classes. The provided code returns a list of endpoints for the displayed products (it doesn't include the website address itself)
Here's an executable example: With SrcTable as (SELECT 'product_id' as key, 'iphone_14' as value from dummy union all SELECT 'product_id' as key, 'iphone_14_pro' as value from dummy union all SELECT 'country_code' as key, 'USA' as value from dummy union all SELECT 'country_code' as key, 'CA' as value from dummy) SELECT * FROM JSON_TABLE('[ {"key": "product_id","value": "iphone_14"}, {"key": "product_id","value": "iphone_14_pro"}, {"key": "country_code","value": "INVALID_VALUE"}, {"key": "country_code","value": "USA"} ]', '$' COLUMNS ( KEY nvarchar(20) PATH '$.key', VALUE nvarchar(20) PATH '$.value' )) EXCEPT --AKA MINUS SELECT key, value FROM srcTable To make work for you: - Eliminate the srctable with statement and replace the srcTable with your validation table name following the "EXCEPT" - You'll also need to pass in the string in the JSON_TABLE as a input parameter with a string with the assumption it has the key/value format as an input parameter with the limits defined in COLUMNS of the JSON_TABLE table value function. However, if the JSON values are stored somehwere already in the hana db; then they could be just selected. it is unclear how this value is to be made availale to the query. Set based operators typically perform efficiently.
**The problem** When i try to scaffold the nordhwind.accdb i get a COM Exception In VSCode Powershell Terminal: ```lang-ps dotnet ef dbcontext scaffold "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=<PATH>\northwind.accdb" EntityFrameworkCore.Jet -o Models ``` In Visual Studio 2022 Paket Manager Console: ```lang-ps Scaffold-DbContext -Connection "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=<PATH>\northwind.accdb" -Provider EntityFrameworkCore.Jet ``` The exception: ``` System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x800A0CB3): Das Objekt oder der Provider kann den angeforderten Vorgang nicht ausführen. --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at EntityFrameworkCore.Jet.Data.ComObject.TryGetMember(GetMemberBinder binder, Object& result) at CallSite.Target(Closure, CallSite, Object) at EntityFrameworkCore.Jet.Data.AdoxSchema.GetColumns() at EntityFrameworkCore.Jet.Data.PreciseSchema.GetColumns() at EntityFrameworkCore.Jet.Data.JetStoreSchemaDefinition.JetInformationSchema.GetColumns(JetConnection connection) at EntityFrameworkCore.Jet.Data.JetStoreSchemaDefinition.JetInformationSchema.GetDbDataReaderFromSimpleStatement(JetCommand command) at EntityFrameworkCore.Jet.Data.JetStoreSchemaDefinition.JetInformationSchema.TryGetDataReaderFromInformationSchemaCommand(JetCommand command, DbDataReader& dataReader) at EntityFrameworkCore.Jet.Data.JetCommand.ExecuteDbDataReaderCore(CommandBehavior behavior) at EntityFrameworkCore.Jet.Data.JetCommand.ExecuteDbDataReader(CommandBehavior behavior) at EntityFrameworkCore.Jet.Scaffolding.Internal.JetDatabaseModelFactory.GetColumns(DbConnection connection, IReadOnlyList`1 tables) at EntityFrameworkCore.Jet.Scaffolding.Internal.JetDatabaseModelFactory.GetTables(DbConnection connection, Func`3 filter) oryOptions options) at EntityFrameworkCore.Jet.Scaffolding.Internal.JetDatabaseModelFactory.Create(String connectionString, DatabaseModelFactoryOptions options) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions__DisplayClass0_0.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) ``` **What i have done so far** I'm currently testing to connect to an existing access mdb using the EntityFrameworkCore.Jet provider. For test purposes i downloaded the latest northwind.accdb from here: https://learn.microsoft.com/de-de/dotnet/framework/data/adonet/sql/linq/downloading-sample-databases I opened the DB in Access and in Visual Studio 2022 (Server Explorer) to ensure it is accessible. Then i created a simple project with a `DbContext`: ```lang-xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net7.0</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="EntityFrameworkCore.Jet" Version="7.0.3" /> <PackageReference Include="EntityFrameworkCore.Jet.Data" Version="7.0.3" /> <PackageReference Include="EntityFrameworkCore.Jet.Odbc" Version="7.0.3" /> <PackageReference Include="EntityFrameworkCore.Jet.OleDb" Version="7.0.3" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.15" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.15"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="System.Data.OleDb" Version="7.0.0" /> </ItemGroup> </Project> ``` ```lang-cs public class JetTestContext : DbContext { protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseJet(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=<PATH>\northwind.accdb;"); } } ``` I also made a little unit test to ensure a can instantiate the `JetTestContext` But this should not influence the scaffolding in any way. I already searched but the only solutions i found are missing or wrong OLEDB drivers and i don't think thats my problem here as i can access the northwinddb, have Access installed and can browse the DB with the VS Server Explorer. What am i missing here?
EntityFrameworkCore.Jet: Scaffold doest not work - COMException (0x800A0CB3)
|ms-access|entity-framework-core|jet|scaffold|
null
I have HTML table with following structure: ``` <table> <thead>..</thead> <tbody> <tr> <td>some</td> <td>content</td> <td>etc</td> </tr> <tr class="certain"> <td><div class="that-one"></div>some</td> <td>content</td> <td>etc</td> </tr> several other rows.. <tbody> </table> ``` And I am trying to figure out what to do with the `<div class="that-one">` (or any other element, if needed) inside the table so it can be painted outside the table. I have tried negative left property, transform: translateX(-20px) and overflow: visible. I know that there is something different with rendering HTML tables. I cannot change structure of the table just can add whetever element inside. Finding: both negative left property and transform: translateX(-20px) work in Firefox but dont work in Chrome (behaves like overflow: hidden). Have some Javascript workaround on my mind, but would rather stay without it. Also, I dont want it as CSS pseudoelement, because there will be some click event binded.
The following KQL query gives me the logs regarding memory usage for an app traces | where timestamp > ago(1d) | where message startswith_cs "memory_profiler_logs:" | parse message with "memory_profiler_logs: " LineNumber " " TotalMem_MiB " " IncreMem_MiB " " Occurrences " " Contents | union ( traces | where timestamp > ago(1d) | where message startswith_cs "memory_profiler_logs: Filename: " | where | parse message with "memory_profiler_logs: Filename: " FileName | project timestamp, FileName, itemId ) | project timestamp, LineNumber=iff(FileName != "", FileName, LineNumber), TotalMem_MiB, IncreMem_MiB, Occurrences, Contents, RequestId=itemId | order by timestamp asc how can I modify the query in order to get only records with IncreMem_MiB > 1000MiB ? I tried adding the following with no success: | where IncreMem_MiB > 1000
How to install NPGSQL and connect a PostgreSQL database to Power BI?
|database|postgresql|powerbi|npgsql|
null
Ok, this seems to be by design. After RTC init mode exits, SSR is reset: https://community.st.com/t5/stm32-mcus-products/stm32-rtc3-mixed-mode-writing-tr-resets-ssr/m-p/655899/highlight/true#M239486
|excel|vba|outlook|
im using Next.js to create a web application and next-intl to translate it to multiple languages. I created the not-found.tsx file to handle 404 errors. What im seeing now if i inspect the html of the 200 pages is that the translations of the 404 page, are loaded as next js <script> tags (self.__next_f.push). How can i not load this translations and make them load only when 404 pages render?
Next intl 404 translations loaded on all non-404 pages
|javascript|reactjs|next.js|next-intl|
null
You are using Spring Boot 3.2 which pulls in JUnit 5. While also using `cucumber-junit` which depends on JUnit 4. Support for JUnit 5 was introduced into Surefire somewhere around v2.22. But Surefire can not run JUnit 4 and JUnit 5 together at the same time and so defaults to the latest version of JUnit when both are available. For the short term you can work around this by either including the `junit-vintage-engine` ```xml <dependency> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> <scope>test</scope> </dependency> ``` For the long term it would be better to stop depending on JUnit 4 all together and switch to the [`cucumber-junit-platform-engine`][1]. You can find a working example (without Spring) in the https://github.com/cucumber/cucumber-java-skeleton. [1]: https://github.com/cucumber/cucumber-jvm/tree/main/cucumber-junit-platform-engine#cucumber-junit-platform-engine
Apple store's webhook (notification api v2) signs all requests. I would like to verify that the object was indeed signed by Apple in order to be sure that the request is coming from them. Apple provides libraries that are able to do that, but unfortunately in the environment I work on, all I can use is the library called 'Jose'. My understanding of cryptography is very shallow but from what I understand, Apple provides their public root, and public intermediate keys. And then they send it inside the JWS's x5c array and expects us to verify that the leaf was signed by the intermediate certificate, and that the intermediate certificate was signed by the root certificate. My goal is to achieve this verification. At the moment I have a [signedPayload][1], and the public intermediate and root keys as env variables. I then do that: try { // I am not sure if this is the correct way to verify apple's certification chain. const intermediatePublicKey = await importSPKI(env.APPLE_INTERMEDIATE_CERTIFICATION, alg); await jwtVerify(leafCertification, intermediatePublicKey); const rootPublicKey = await importSPKI(env.APPLE_ROOT_CERTIFICATION, alg); await jwtVerify(intermediateCertification, rootPublicKey); } catch { return new Response('Failed to verify apple certification chain.', {status: 401}); } Basically I expect it to throw if it couldn't be validated, but I guessed the whole process so it's probably not going to work. How do I approach this problem? [1]: https://developer.apple.com/documentation/appstoreservernotifications/signedpayload
I'm trying to use native api. I have the following code to get the 5 most used apps. It's a Native Android module with TypeScript because I can't call APIs with React Native: ``` fun getUsageData(startTime: Double, endTime: Double, successCallback: Callback) { val usageStatsManager = reactApplicationContext.getSystemService(Context.USAGE_STATS_SERVICE) as // Query usage stats val usageStatsList = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, startTime.toLong(), endTime.toLong()) // Sort usage stats by total time in foreground usageStatsList.sortByDescending { it.totalTimeInForeground } // Extract package names of top 5 used apps val topApps: WritableArray = WritableNativeArray() for (i in 0 until minOf(5, usageStatsList.size)) { val packageName = usageStatsList[i].packageName topApps.pushString(packageName) } // // Pass the top apps list back to React Native successCallback.invoke(topApps) } ``` But my list is always empty in Typescript and I don't know why: `LOG Top 5 used apps: []` And this is my TypeScript code: ``` const getUsageData = () => { const startTime = new Date().getTime() - (7 * 24 * 60 * 60 * 1000); const endTime = new Date().getTime(); UsageStatsModule.getUsageData(Number(startTime), Number(endTime), (topApps : any) => { console.log('Top 5 used apps:', topApps); }); }; ``` I don't know how to start for debug, because I have no error and I didn't practice mobile development. Edit : I made a few changes to get more information but it wasn't conclusive: In the manifest.xml : <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> and in the module file : @ReactMethod fun getUsageData(startTime: Double, endTime: Double, successCallback: Callback) { try { val usageStatsManager: UsageStatsManager = this.reactApplicationContext.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager val cal: Calendar = Calendar.getInstance() cal.add(Calendar.DAY_OF_MONTH, -1) // Query usage stats val usageStatsList = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, cal.timeInMillis, System.currentTimeMillis()) ?: throw SecurityException("Permission denied or usage stats not available") // Sort usage stats by total time in foreground usageStatsList.sortByDescending { it.totalTimeInForeground } Log.d("a", "a : " + usageStatsList.size) // Extract package names of top 5 used apps val topApps: WritableArray = WritableNativeArray() for(i in 0..usageStatsList.size - 1) { val packageName = usageStatsList[i].packageName topApps.pushString(packageName) } // Pass the top apps list back to React Native successCallback.invoke(topApps) } catch (e: Exception) { // Handle exceptions e.printStackTrace() // Notify React Native about the error // You might want to handle this differently based on your app's requirements successCallback.invoke(WritableNativeArray().apply { pushString("Error: ${e.message}") }) } } Edit : PLease, anyone have an idee ? I m still stuck on this !
{"Voters":[{"Id":1417694,"DisplayName":"Squashman"},{"Id":9214357,"DisplayName":"Zephyr"},{"Id":3074564,"DisplayName":"Mofi"}]}
Xampp not connecting to DBForge what to do? [xampp](https://i.stack.imgur.com/xycb6.png)[dbforge](https://i.stack.imgur.com/aCrDu.png) I clicked on xampp mysql start and opened dbforge then i clicked to new connection in dbforge but the user and root did not popped up only that window what i attached here as a dbforge picture. I use win 10 OS, vscode, vuejs3, laravel10, git etc etc, just reinstalled OS and reinstalled all the programs and extensions, that took a while believe me, everything worked now i'm stuck here. What i only tried was to refresh, delete localhosts..... then went to search to google. Thanks in advance:)
Xampp not connecting to DBForge what to do?
|xampp|dbforge|
null
I have a database with points, and want to subtract the points I just added after a year. I figured I would use a queue job and subtract my points later. I followed this official laravel link: https://laravel.com/docs/4.2/queues#queueing-closures Here is a snippet: ``` DB::table('users')->where('id', $user_id)->increment('points_single', $points); //create the date when the points should be subtracted $date = Carbon::now()->addMinutes(120); //push the job onto the queue Queue::later($date, function($job) use ($user_id, $points) { DB::table('users')->where('id', $user_id)->decrement('points_single', $points); $job->delete(); }); ``` The problem is the job runs instantly, even though I specified a new date time. Why is that?
How to use Queue::late in laravel 4.2?
|laravel|php-carbon|laravel-4.2|
In my project, we work with constantly update of components. In a specific screen, we have a TabView with a dynamic list of items, these items may be updated. The problem is: If these items is inside a TabView with .tabViewStyle(.page), the item updated isn’t updated. I made a example code that can reproduce this behavior: ``` struct TextUIModel: Identifiable, Equatable { let id = UUID() let title: String let state: String } public class TextUIViewModel: ObservableObject { u/Published var models: [TextUIModel] = [ .init(title: "Title", state: "1"), .init(title: "Title", state: "2") ] func updateModel() { models[0] = .init(title: "Title", state: "2") } } public struct TextUIModelsContentView: View { @StateObject var viewModel: TextUIViewModel = .init() public init() {} public var body: some View { if viewModel.models.isEmpty { Text("Empty") } else { TabViewForTExtUIModels(models: viewModel.models) } Button("Update states") { viewModel.updateModel() } } } struct TabViewForTExtUIModels: View { let models: [TextUIModel] var body: some View { VStack { if !models.isEmpty { TabView { ForEach(models) { model in VStack { Text(model.title) Text(model.state) } } } .tabViewStyle(.page) } else { EmptyView() } } } } ``` When the button is pressed, nothing happens, but if I change the TabView for a ScrollView works: ``` struct TabViewForTExtUIModels: View { let models: [TextUIModel] var body: some View { VStack { if !models.isEmpty { ScrollView { LazyHStack { ForEach(models) { model in VStack { Text(model.title) Text(model.state) } } } } } else { EmptyView() } } } } ``` I tried manage the update using State and Binding, but nothing works To have the behavior of a TabView with .tabViewStyle(.page) is a part of the demand I tried a lot of things but nothing works, only taking off the TabView that is not an option. Can anyone help me ?
I am using `mathjax` and `Shiny` to display equations. But the output text doesn't seem to me to be of very high quality. How do I increase the dpi or the resolution of the output, which seems to be a dull or transparent black or isn't at it's full "brightness", if that makes sense? library(shiny) library(mathjaxr) ui <- fluidPage( title = 'MathJax Examples', uiOutput('ex3')) server <- function(input, output, session){ output$ex3 <- renderUI({ withMathJax( helpText( "$$\\log_{10}p_w = \\frac{-1.1489t}{273.1+t}-1.330\\text{e-}05t^2 + 9.084\\text{e-}08t^3 - 1.08\\text{e-}09t^4 +\\log_{10}p_i\\\\[15pt] \\log_{10}p_i=\\frac{-2445.5646}{273.1+t}+8.2312\\log_{10}\\left(273.1+t\\right)-0.01677006\\left(273.1+t\\right)+1.20514\\text{e-}05\\left(273.1+t\\right)^2-6.757169\\\\[15pt] p_i=saturated\\space vapor\\space pressure\\space over\\space ice\\space \\left(mmHg\\right)$$" )) })} shinyApp(ui = ui, server = server)
How to increase quality of mathjax output?
|css|r|text|shiny|mathjax|
One way to handle this is to put a timeout on the socket with settimeout(), and handle socket.timeout exceptions raised by recv() or recvfrom(). Normally you will simply retry the recv() in a loop, but each time the socket times out, you have a chance to poll for a shutdown flag, etc. The downside, of course: - There will be a delay of as much as the timeout interval for a kill request to complete. The longer the timeout interval, the greater the kill latency. - During idle time (no packets being received), there will be a small CPU overhead for retries. The shorter the timeout interval, the greater the CPU overhead.
{"Voters":[{"Id":6738015,"DisplayName":"Compo"},{"Id":9214357,"DisplayName":"Zephyr"},{"Id":3074564,"DisplayName":"Mofi"}],"SiteSpecificCloseReasonIds":[11]}
I've been coding for awhile now and I was wondering what I could do to be more efficient when it comes to coding or any advice of what I'm doing incorrect. I think the things I can probably point out right off the bat is my misuse of width on majority of the tags. I also remember reading something that I should be using input instead of button but am not exactly sure. Thanks for taking your time reviewing my code! [Photo of my coding](https://i.stack.imgur.com/DtdIa.png) ``` <!DOCTYPE html> <html> <head> <style> .list-of-friends { display: block; border: solid; width: 300px; padding-left:30px; margin-left: 30px; } .profile-picture { display: inline-block; } .profile-picture, .user-name, follow-button { vertical-align: middle; } p, button { font-family: Arial; } .oliver-profile, .mimi-profile, .rex-profile { width: 300px; height: 100px; margin-bottom: 20px; } .photo { border-radius: 50%; width: 60px; height: 60px; } .info { display: inline-block; width: 225px; } .user-name { display: inline-block; font-size: 14px; line-height: 8px; width: 70px; } .name, .follow { font-weight: bold; font-size: 15px; } .description, .rating { color: rgb(96, 96, 96); } .follow-button { display: inline-block; margin-left: 60px; } button { padding-top: 8px; padding-bottom: 8px; padding-left: 7px; padding-right: 7px; background-color: rgb(2, 158, 255); color: white; border: none; border-radius: 4px; cursor: pointer; transition: 0.3s; } button:hover { opacity: 0.7; } button:active { opacity: 0.5; } </style> </head> <body> <div class="list-of-friends"> <div class="oliver-profile"> <div class="profile-picture"> <img class="photo" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS6DE-7qYRuIujluCF1GJzR5V-bGATSDTqtzw&usqp=CAU"> </div> <div class="info"> <div class="user-name"> <p class="name">Oliver</p> <p class="description">The Cat</p> <p class="rating">Popular</p> </div> <div class="follow-button"> <button class="follow">Follow</button> </div> </div> </div> <div class="mimi-profile"> <div class="profile-picture"> <img class="photo" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTcr6E-AL2FTIOZmGKYOcs3sUDHA_CPqVhr3w&usqp=CAU"> </div> <div class="info"> <div class="user-name"> <p class="name">Mimi</p> <p class="description">Sleepy Cat</p> <p class="rating">Popular</p> </div> <div class="follow-button"> <button class="follow">Follow</button> </div> </div> </div> <div class="rex-profile"> <div class="profile-picture"> <img class="photo" src="https://d2zp5xs5cp8zlg.cloudfront.net/image-53920-800.jpg"> </div> <div class="info"> <div class="user-name"> <p class="name">Rex</p> <p class="description">Happy Cat</p> <p class="rating">Popular</p> </div> <div class="follow-button"> <button class="follow">Follow</button> </div> </div> </div> </div> </body> </html>```
KQL : how to get memory increments above certain threshold?
|kql|
Use the [`row_number()`][2] window function, but don't forget you also need an adequate [collation][3] for that to work properly with your week codes: [demo at db<>fiddle][4] ``` CREATE COLLATION num_ignore_punct (provider = icu, locale = 'und-u-ka-shifted-kn'); SELECT "WeekCode", "Revenue", ceil(row_number()OVER(ORDER BY "WeekCode" COLLATE num_ignore_punct)/4.) "Grouping" FROM my_table; ``` | WeekCode | Revenue | Grouping | |:---------|--------:|---------:| | FY23 W1 | 21531 | 1 | | FY23 W2 | 4927 | 1 | | FY23 W3 | 22651 | 1 | | FY23 W4 | 5612 | 1 | | FY23 W5 | 16307 | 2 | | ...| ...| ...| | FY23 W24 | 44012 | 6 | You also need to keep in mind that [mixed-case identifiers require double-quoting in PostgreSQL][5], otherwise they get folded to lowercase, which can lead to surprising mismatches. There are plenty [mathematical][6] tricks based on modulo 4 that'll get you a single increment every 4 steps. I like `ceil(x/4.)` because it does just two things. `(3+x)/4` is *also* nice. `1+(x-1)/4` is *almost* as nice. [Difference][8] is rather negligible. *** If you don't use a collation that treats digits as numbers, default will sort 10-19 between 1 and 2: ``` select "WeekCode", "Revenue", 1 + (row_number() over (order by "WeekCode") - 1) / 4 from my_table ``` | WeekCode | Revenue | ?column? | |:---------|--------:|---------:| | FY23 W1 | 21531 | 1 | | FY23 W10 | 36549 | 1 | | FY23 W11 | 37566 | 1 | | ...|...|...| | FY23 W19 | 22971 | 3 | | FY23 W2 | 4927 | 3 | | FY23 W20 | 42099 | 4 | [1]: https://www.postgresql.org/docs/current/functions-srf.html [2]: https://www.postgresql.org/docs/current/functions-window.html [3]: https://www.postgresql.org/docs/current/collation.html#ICU-CUSTOM-COLLATIONS [4]: https://dbfiddle.uk/mzE88XGy [5]: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS [6]: https://www.postgresql.org/docs/current/functions-math.html [7]: https://dbfiddle.uk/AcVyZBaV [8]: https://dbfiddle.uk/pVH3dqHi
The problem is that you are trying to assign the same ref for all your components. a ref needs to be assined to a single instance of a component so we can modify your code to the following ``` import React, { useRef, useEffect } from "react"; const DynamicComponent = React.forwardRef(({ name }, ref) => { // Some component logic here... return <div ref={ref}>{name}</div>; }); const HOC = ({ dynamicComponentProps }) => { const dynamicRefs = dynamicComponentProps.map(() => useRef(null)); useEffect(() => { dynamicRefs.forEach((ref) => { console.log(ref.current); // This should log the div element // Some other logic with ref.current... }); }, [dynamicRefs]); const renderDynamicComponent = () => { return dynamicComponentProps.map((props, index) => ( <DynamicComponent ref={dynamicRefs[index]} key={index} {...props} /> )); }; return <div>{renderDynamicComponent()}</div>; }; const App = () => { const dynamicComponentProps = [ { name: "Component A" }, { name: "Component B" }, { name: "Component C" }, ]; return <HOC dynamicComponentProps={dynamicComponentProps} />; }; export default App; ``` in this updated version we have a seperate ref foreach component. to make this work we add to modfiy a few other things as well 1. changed DynamicComponent to forwardRef so that we can pass a ref 2. in the useEffect we log the array of refs 3. in renderDynamiccomponent we assign a different ref to each component
Working on upgrading an application from JDK 11 to JDK 17 and it has an issue with Avro that I'm not certain how to get around. I did have a lot of messages about the new LocalDate(string) method was being deprecated and removed and I was able to take care of that in the regular code. Howver in the Avro avdl file I have @java-class("java.time.LocalDate") string orderDate which is leading to this.orderDate = new java.time.LocalDate(in.readString()). I fixed this in code with parse(string) but not sure how to make the avro build that way or if I need to just make this its own class instead of using Avro.
Avro after upgrading to JDK 17
|java|gwt|avro|
I believe the root issue happens when creating the 'selectedInvoices' variable, that map creates an array of strings and the values you retrieve later on from your database sheet are integers. Please try this code: function promptUserToSelectInvoices(data) { // Prompts the user to enter invoice numbers separated by commas var selectedInvoices = []; var ui = SpreadsheetApp.getUi(); var response = ui.prompt('Select Invoices to Print', 'Enter the invoice numbers separated by commas:', ui.ButtonSet.OK_CANCEL); if (response.getSelectedButton() === ui.Button.OK) { var input = response.getResponseText().trim(); selectedInvoices = input.split(',').map(function(value) { return parseInt(value.trim()); //This is the updated line }); // Calls the PrintSelectedToPDF() function with the selectedInvoices array PrintSelectedToPDF(selectedInvoices); } }
Note that the formula for slope in simple linear regression without intercept is ```sum(x*y)/sum(x^2)```. We can utilize this in matrix form: ``` diag(t(M.x) %*% M.y) / diag(t(M.x) %*% M.x) [1] 0.142780158 -0.688172617 0.591777820 1.096226652 0.458449019 -0.729486974 -0.161225471 [8] -0.275493553 0.500602766 -0.175171117 -0.400500634 0.111438175 0.005283035 -0.302037119 [15] -0.588920240 -1.675476344 -1.609057813 0.047642782 -0.229759970 -0.599253230 2.537797206 ```
**Environment:** Laravel with Filament on Docker (Laravel Sail) The request is made using `https://` but there are 2 files (`table.js` and `select.js`) which seem to be being requested by `http://` which is causing the following CORS error: ``` Access to script at 'http://test.docker.localhost/js/filament/forms/components/select.js?v=3.2.50.0' from origin 'https://test.docker.localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. async-alpine.js?v=3.2.50.0:1 GET http://test.docker.localhost/js/filament/forms/components/select.js?v=3.2.50.0 net::ERR_FAILED ```
CORS Error caused by JS files being requested by http in an https environment using Laravel Filament with Sail / Docker
|laravel|docker|laravel-sail|laravel-filament|filamentphp|
This is caused due to reverse-proxying and the app thinking that it is being served by http when actually it's being served by https. The following can be added to the `bootstrap/app.php` file in Laravel 11+ to resolve this: ``` ->withMiddleware(function (Middleware $middleware) { $middleware->trustProxies(at: [ // proxy ips as array ]); }) ``` Reference: https://laravel.com/docs/11.x/requests#configuring-trusted-proxies
What can I do to improve my coding on both html and css
|html|css|nested|structure|
null
*There is very good post about trimming 1fr to 0: https://stackoverflow.com/questions/52861086/why-does-minmax0-1fr-work-for-long-elements-while-1fr-doesnt* In general I would like to have a cell which expands as the content grows, but within the limits of its parent. Currently I have a grid with cell with such lengthy content that even without expanding it is bigger than the entire screen. So I would to do two things -- clip the size of the cell, and secondly -- provide the scroll. I used `minmax(0, 1fr)` from the post I mentioned, so grid has free hand to squash the cell to zero, but it still does not effectively compute the height, so the scroller does not not the "fixed" height. Without this information the scroll is not activated. <!-- begin snippet: js hide: false console: false babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> body { width: 100vw; height: 100vh; margin: 0; padding: 0; overflow: hidden; } .page { height: 100%; /*display: flex; flex-direction: column;*/ display:grid; grid-template-rows: min-content minmax(0, 1fr); } .header { } .content { flex-grow: 1; flex-shrink: 1; flex-basis: 0; } .quiz-grid { height: 100%; max-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) min-content; grid-template-areas: "left main right" "footer footer footer"; } .quiz-cell-left { grid-area: left; min-height: 0; } .quiz-cell-right { grid-area: right; min-height: 0; } .quiz-cell-main { grid-area: main; border: 1px red solid; min-height: 0; } .quiz-cell-footer { grid-area: footer; justify-self: center; align-self: center; } /* my scroll view component */ .scroll-container { position: relative; width: 100%; min-height: 0; background-color: azure; max-height: 100%; } .scroll-content { height: 100%; width: 100%; overflow-y: auto; } </style> </head> <body> <div class="page"> <div class="header">Header</div> <div class="content"> <div class="quiz-grid"> <div class="quiz-cell-main"> <div class="scroll-container"> <div class="scroll-content"> <h1>something<h1> <h1>else<h1> <h1>alice<h1> <h1>cat<h1> <h1>or dog<h1> <h1>now<h1> <h1>world<h1> <h1>something<h1> <h1>else<h1> <h1>alice<h1> <h1>cat<h1> <h1>or dog<h1> <h1>now<h1> <h1>world<h1> <h1>something<h1> <h1>else<h1> <h1>alice<h1> <h1>cat<h1> <h1>or dog<h1> <h1>now<h1> <h1>world<h1> <h1>something<h1> <h1>else<h1> <h1>alice<h1> <h1>cat<h1> <h1>or dog<h1> <h1>now<h1> <h1>world<h1> </div> </div> </div> <div class="quiz-cell-footer"> footer </div> </div> </div> </div> </body> </html> <!-- end snippet --> *Comment to the code: the content sits in cell "main", the other elements (header, footer) are just to make sure the solution would not be over simplified.* **Update**: originally I used "flex" for outer layout, I switched to grid and I managed to achieve the partial clip at least, I am still stuck with my real clip with scroll.
You did not answer my clarification question... 1. **There is not any command line able to write in the workbook**. You can see the list of available command lines [here](https://support.microsoft.com/en-us/office/command-line-switches-for-microsoft-office-products-079164cd-4ef5-4178-b235-441737deb3a6?ui=en-us&rs=en-us&ad=us#Category=Excel). You can open Excel application, a workbook or more, with or without the startup screen, read only etc. 2. In order to use parameters/arguments to be sent to Excel workbook you need a way to **read the command line and process it in order to extract the arguments**. Knowing that, it is enough to pass any string as argument, let us say, "Date" and *instruct* the VBA code to place the current date instead, when it exists as the last `argument`. Not showing the code able to catch the command line and see what does it with the extracted arguments, it is difficult (to avoid impossible) to be helped... 3. Supposing that you understand a little Excel VBA coding, I will place a piece of code able to process what you name arguments and do something with any such argument, separated by comma: 3.1 Insert a standard module, name it "CmdLineExtractString", and copy inside the next code: ``` Option Explicit #If VBA7 Then Declare PtrSafe Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As LongLong Declare PtrSafe Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) #Else Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As Long Declare Function lstrlen Lib "kernel32" (ByVal lpString As string) As Long Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ (MyDest As Any, MySource As Any, ByVal MySize As Long) #End If Public Function CmdLineToStr() As String 'Returns the whole command line used to open Excel: Dim Buffer() As Byte, StrLen As Long #If VBA7 Then Dim CmdPtr As LongLong #Else Dim CmdPtr As Long #End If CmdPtr = GetCommandLine() If CmdPtr > 0 Then #If VBA7 Then StrLen = lstrlen(CmdPtr) * 32 #Else StrLen = lstrlen(CmdPtr) * 2 #End If If StrLen > 0 Then ReDim Buffer(0 To (StrLen - 1)) As Byte CopyMemory Buffer(0), ByVal CmdPtr, StrLen CmdLineToStr = Buffer End If End If End Function Function ExtractArguments(strCmd As String) As String ExtractArguments = Mid(strCmd, InStr(strCmd, "/")) End Function Sub ProcessArguments(strArgs As String) Dim arr, ws As Worksheet, lastEmptyR As Long arr = Split(Trim(Mid(strArgs, InStrRev(strArgs, "/") + 1)), ",") If InStr(arr(UBound(arr)), "Date") > 0 Then arr(UBound(arr)) = Now 'place the current date/time instead of "Date" string Set ws = ThisWorkbook.Worksheets("Sheet1") lastEmptyR = ws.Range("A" & ws.Rows.Count).End(xlUp).Row + 1 'determine the last empty cell in A:A ws.Range("A" & lastEmptyR).Resize(, UBound(arr) + 1).Value = arr 'drop the array content in A:C, on lastEmptyR End Sub ``` I tested only in 64 bit environment. I do not have any 32 bit computer available. I found on the internet the code **only for 32 bit**, and adapted to 64 bit... As I adapted, I think it should also work on 32 bit. But I did not tested it. 3.2 Insert the next code (auto Open event) inside `ThisWorbook` code module: ``` Option Explicit Private Sub Workbook_Open() Dim strCmd As String strCmd = CmdLineExtractString.CmdLineToStr 'extract the whole command line used to open the workbook ProcessArguments ExtractArguments(strCmd) 'call the Sub processing arguments... End Sub ``` It will return each argument in columns A:C, on the last empty row (in A:A) of "Sheet1" worksheet. In C:C it will be returned the actual time (date + time: `31.03.2024 22:10:05`), If you need only the current date, please replace `Now` with `Date`... Now test it using `Run` window. Please, press `Windows key` + `R`, use the next command line: ``` excel.exe "C:\File\Path\MyMacroEnabledFile.xlsm" /e/arg1,arg2,Date ``` and press `Enter`... Of course, you need to use the real workbook full name... I tried commenting lines which could not be understood. If something still not clear, do not hesitate to ask for clarification.
I'm working on a .net project. I am trying to pay out some amount to my connected account. I tried with amount = 15 This is my account balance object. ``` "object": "balance", "available": [ { "amount": 1929490, "currency": "aud", "sourceTypes": { "card": 1929490 }, "rawJObject": null, "stripeResponse": null } ], "connectReserved": [ { "amount": 0, "currency": "aud", "sourceTypes": null, "rawJObject": null, "stripeResponse": null } ], "instantAvailable": [ { "amount": 1200000, "currency": "aud", "sourceTypes": { "bankAccount": 0, "card": 1200000, "fpx": 0, "rawJObject": null, "stripeResponse": null }, "rawJObject": null, "stripeResponse": null } ], "issuing": null, "livemode": false, "pending": [ { "amount": 108924, "currency": "aud", "sourceTypes": { "card": 108924 }, "rawJObject": null, "stripeResponse": null } ], ``` I've tried some methods. I'll post them here. Method 1: Connect account selected his bank account for payouts (NOT card) and check following request [![connect account setting - payout - bank account][1]][1] Request : ``` var options = new PayoutCreateOptions { // Destination = connectAccountId, Description = description, Method = "standard",// standard or instant SourceType = "bank_account", // options are bank_account, card, or fpx Amount = amount, Currency = "aud", Metadata = new Dictionary<string, string> { { "ConnectAccountId", connectAccountId } }, }; var requestOptions = new RequestOptions(); requestOptions.StripeAccount = connectAccountId; var service = new PayoutService(); return service.Create(options, requestOptions); ``` Response : "You have insufficient funds in your Stripe account for this transfer. Your ACH balance is too low. You can use the /v1/balance endpoint to view your Stripe balance (for more details, see stripe.com/docs/api#balance)." Nethod 2:Connect account selected his bank account for payouts (NOT card) and check following request ``` var options = new PayoutCreateOptions { // Destination = connectAccountId, Description = description, Method = "standard",// standard or instant SourceType = "card", // options are bank_account, card, or fpx Amount = amount, Currency = "aud", Metadata = new Dictionary<string, string> { { "ConnectAccountId", connectAccountId } }, }; ``` Response: "You have insufficient funds in your Stripe account for this transfer. Your card balance is too low. You can use the /v1/balance endpoint to view your Stripe balance (for more details, see stripe.com/docs/api#balance)." Method 3: Connect account selected his debit card for payouts (NOT bank account) and check the following request. [![connect account setting payout - card][2]][2] Request: is same as request of method 2. Response: "Method `standard` is not supported for payouts to debit cards." Method 4: Connect account selected his debit card for payouts (NOT bank account) and check the following request. ``` var options = new PayoutCreateOptions { // Destination = connectAccountId, Description = description, Method = "instant",// standard or instant SourceType = "card", // options are bank_account, card, or fpx Amount = amount, Currency = "aud", Metadata = new Dictionary<string, string> { { "ConnectAccountId", connectAccountId } }, }; ``` Response: "You have insufficient funds in your Stripe account for this transfer. Your card balance is too low. You can use the /v1/balance endpoint to view your Stripe balance (for more details, see stripe.com/docs/api#balance)." Method 5: Connect account selected his debit card for payouts (NOT bank account) and check the following request. Request : ``` var options = new PayoutCreateOptions { // Destination = connectAccountId, Description = description, Method = "instant",// standard or instant SourceType = "bank_account", // options are bank_account, card, or fpx Amount = amount, Currency = "aud", Metadata = new Dictionary<string, string> { { "ConnectAccountId", connectAccountId } }, }; ``` Response : "You have insufficient funds in your Stripe account for this transfer. Your ACH balance is too low. You can use the /v1/balance endpoint to view your Stripe balance (for more details, see stripe.com/docs/api#balance)." I'm tired of searching for the reason for these issues. I want to payout the amount to Connect's bank account. Please help me. [1]: https://i.stack.imgur.com/KZs1X.png [2]: https://i.stack.imgur.com/IleD9.png
Stripe connect payout - throws exceptions
|.net|stripe-payments|payout|
I need to initialize list of uint. I read that one can initialize each item in list, but I need efficient way, i.e. as in systemverilog where you can initialize with {1,2,3...}
How to initialize list of uint in Specman?
|specman|
I have a list of things and want to get them in two seperate colums. Can I do that by using search and replace ? or How do I do this ? Here is an example [how it is now](https://i.stack.imgur.com/ZwIC0.png) [how it should be](https://i.stack.imgur.com/Jl8Ly.png) google sheets, find and replace, next column
google sheets, search and replace for next colum
|google-sheets|find-replace|
null
This is from a .ipynb jupyter notebook in vscode in windows 10: even when I pip install pandas in the terminal it still gives this error: --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[1], line 2 1 import numpy as np ----> 2 import pandas as pd 3 import matplotlib.pyplot as plt 5 # pip install wheel webencodings jinja2 packaging markupsafe werkzeug flatbuffers libclang typing-extensions wrapt ModuleNotFoundError: No module named 'pandas' I tried typing 'pip install pandas' in my vscode terminal and it showed this: Requirement already satisfied: pandas in c:\users\s2hun\desktop\machine learning intro\magic\lib\site-packages (2.2.1) Requirement already satisfied: numpy<2,>=1.26.0 in c:\users\s2hun\desktop\machine learning intro\magic\lib\site-packages (from pandas) (1.26.4) Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\s2hun\desktop\machine learning intro\magic\lib\site-packages (from pandas) (2.9.0.post0) Requirement already satisfied: pytz>=2020.1 in c:\users\s2hun\desktop\machine learning intro\magic\lib\site-packages (from pandas) (2024.1) Requirement already satisfied: tzdata>=2022.7 in c:\users\s2hun\desktop\machine learning intro\magic\lib\site-packages (from pandas) (2024.1) Requirement already satisfied: six>=1.5 in c:\users\s2hun\desktop\machine learning intro\magic\lib\site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0) I then ran the cell which contained this code: import numpy as np import pandas as pd import matplotlib.pyplot as plt When I did so the following error appeared: --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[2], line 2 1 import numpy as np ----> 2 import pandas as pd 3 import matplotlib.pyplot as plt 5 # pip install wheel webencodings jinja2 packaging markupsafe werkzeug flatbuffers libclang typing-extensions wrapt ModuleNotFoundError: No module named 'pandas' I don't know how to fix this and I have had the same problem installing various other python modules in the past.
|tcp|tcpclient|tcpdump|
null
This is possible by modifying the default code in the main (also make sure to import ssl) import ssl if __name__ == "__main__": try: ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) ssl_context.load_cert_chain('./certs/cert.pem', './certs/key.pem') web.run_app(APP, host="localhost", port=CONFIG.PORT, ssl_context=ssl_context) except Exception as error: raise error Keep in mind you cannot use self-signed certs, even for testing [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/dOS6b.png
I'm having a small problem with my code. The case is: I have a <img> element and a button to browse for a file. When I click the button I can select an image (jpg or png) max size of 2mbs. The "strange" is this, when I click the button for the first time, nothing shows on the <img>, but if a click the second time and choose the same image, the image appears. If I click again and choose another image, the same thing happens. The question is: how can I resolve resolve this problem ? ``` $(".brw").on("click", function() { var dtid = $(this).attr("data-id"); var fileDialog = $('<input type="file" accept=".png, .jpg">'); fileDialog.click().on("change",function() { var oName = $(this)[0].files[0].name; var lastDot = oName.lastIndexOf('.'); var oExt = oName.substring(lastDot + 1); var oSize = Math.round($(this)[0].files[0].size / 1024); if(oName == undefined || oName == 0) return; if(oExt != "jpg" && oExt != "png") return; if(oSize > 2000) { $('#in'+dataId).show().delay(3000).fadeOut(300); // Show alert about image size larger than 2mbs return; } var reader = new FileReader(); reader.onload = function(event) { // Add image to the corresponding <img> element $('#' + dtid).attr("src", event.target.result); // Get the size of the selected image, adjust the aspect ratio and then modify the size of the corresponding <img> element var newimg = new Image(); newimg.src = event.target.result; var xheight = newimg.height; var xwidth = newimg.width; var ratio = Math.min(1, 320 / xwidth, 300 / xheight); $('#'+dtid).css({width:xwidth * ratio, height:xheight * ratio}); // ----------------------------------- }; reader.onerror = function(event) { alert("I AM ERROR: " + event.target.error.code); }; reader.readAsDataURL($(this)[0].files[0]); console.log('Trigger : ' + dtid); console.log('Nome : ' + oName); console.log('Extensão : ' + oExt); console.log('Tamanho : ' + oSize); }); return false; }); ``` The <img> element. ``` <center><img src="imgs/n.png" width="350px" height="300px" style="border: 2px dashed red" id="i1" alt=""/></center> <input type="button" value="Browse..." class="imgs brw" data-id="i1" /> ``` Thank you So, the code works, but only when I select the image for the second time. What I expect is to click the button for the first time and the image appears on <img> element
How to update an item inside if a TabView with .tabViewStyle(.page)?
|ios|swift|swiftui|scrollview|tabview|
null
I am trying to create a function that generates a question and stores it into the database using Java Spring. I'm uncertain whether the issue lies in the JSON or the structure of my code. (I've provided both below.) Here's the structure I'm currently using: **Question Service Implementation** ``` @Service public class QuestionServiceImpl implements QuestionService { private final QuestionRepository questionRepository; private final ConversionService conversionService; public QuestionServiceImpl(QuestionRepository questionRepository, ConversionService conversionService) { this.questionRepository = questionRepository; this.conversionService = conversionService; } @Override public QuestionOutput createQuestion(QuestionInput input) { Question question = conversionService.convert(input, Question.class); Question savedQuestion = questionRepository.save(question); return conversionService.convert(savedQuestion, QuestionOutput.class); } ``` **Question Controller** ``` @RestController @RequestMapping("/question") public class QuestionController { private final QuestionService questionService; public QuestionController(QuestionService questionService) { this.questionService = questionService; } @PostMapping public ResponseEntity<QuestionOutput> createQuestion(@RequestBody QuestionInput input){ return new ResponseEntity<>(questionService.createQuestion(input), HttpStatus.CREATED); } } ``` **Question Output** ``` @Getter @Setter @AllArgsConstructor @NoArgsConstructor @Builder public class QuestionOutput { private String id; private String questionBody; private Difficulty difficulty; private Category category; private Quiz quiz; private List<Answer> answers; } ``` This class is meant to handle the input of the user: **Question Input** ``` @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Builder public class QuestionInput { private Answer answer; private Difficulty difficulty; private Category category; private String questionBody; private Quiz quiz; private List<Answers> answers; } ``` **Question Input to Question entity** ``` @Component public class QuestionInputToQuestion implements Converter<QuestionInput, Question> { @Override public Question convert(QuestionInput source) { return Question.builder() .questionBody(source.getQuestionBody()) .answers(source.getAnswers()) .category(source.getCategory()) .quiz(source.getQuiz()) .difficulty(source.getDifficulty()) .build(); } } ``` **Question to Question Output** ``` @Component public class QuestionToQuestionOutput implements Converter<Question, QuestionOutput> { @Override public QuestionOutput convert(Question source) { return QuestionOutput .builder() .id(source.getId()) .questionBody(source.getQuestionBody()) .difficulty(source.getDifficulty()) .category(source.getCategory()) .quiz(source.getQuiz()) .answers(source.getAnswers()) .build(); } } ``` **JSON** ```json { "answer": { "id": "string", "answer": "string", "isRight": true, "question": { "id": "string", "questionBody": "string", "difficulty": "string", "category": "string", "quiz": "string", "answers": [ "string" ] } }, "difficulty": { "id": "string", "difficulty": "string", "questions": [ { "id": "string", "questionBody": "string", "difficulty": "string", "category": "string", "quiz": "string", "answers": [ "string" ] } ] }, "category": { "id": "string", "categoryName": "string", "questions": [ { "id": "string", "questionBody": "string", "difficulty": "string", "category": "string", "quiz": "string", "answers": [ "string" ] } ] }, "questionBody": "string", "quiz": { "id": "string", "user": { "id": "string", "username": "string", "email": "string", "password": "string", "permissions": [ { "id": "string", "permissions": "string", "users": [ "string" ] } ], "quizzes": [ "string" ] }, "questions": [ { "id": "string", "questionBody": "string", "difficulty": "string", "category": "string", "quiz": "string", "answers": [ "string" ] } ] }, "answers": [ { "id": "string", "answer": "string", "isRight": true, "question": { "id": "string", "questionBody": "string", "difficulty": "string", "category": "string", "quiz": "string", "answers": [ "string" ] } } ] } ``` When I make a request with this is the error I get Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of `com.example.quizproject.db.entities.Difficulty` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('string')] I know it's because of `"difficulty": "string"`, but I don't know how to change the code. Thanks in advance!