Posts

Showing posts from 2022

convert a string of a math formula to Object Tree in Javascript?

a function that converts a math string passed as a prop (with the operations + , - , / , * ) by returning an object that contains pieces of the math string, in an ordered/better way easier to loop on it then. test cases if you need them: Example 1: Basic Math (same operation) N Input (string) Output (object) 1 1 { values: [1], operation: null } 2 1+1 { values: [1,1], operation: "+" } 3 1+2+3 { values: [1,2,3], operation: "+" } 4 3-2-1 { values: [3,2,1], operation: "-" } 5 10*80 { values: [10,80], operation: "*" } 6 100/10 { values: [100,10], operation: "/" } Example 2: Formula with 2 operations ➡️ + and - samples N1 input: 1+1-1 output: { values: [ { values: [1, 1], operation: "+", }, 1, ], operation: "-", }; N2 input: 3+2-1+5 output: { values: [ { values: [ { values: [3, 2], ...

Coud not convert Java to Kotlin from IntelliJ [closed]

I tried to convert some Java source files to Kotlin from IntelliJ IDEA Community Edition. I open my Java source file in the IDE, right click on the file name tab, select Convert Java File to Kotlin File. The IDE responds with a dialogue box telling me that Kotlin is not configured in the project and that I will have to configure Kotlin before performing a conversion. I select the button labelled "OK, configure Kotlin in the project". The IDE responds with another dialogue box asking me to accept the Kotlin compiler and runtime version. Although the version disclosed in the attached screen shot says 1.8.0-RC2, I have selected 1.8.0 from the drop down menu, and I still receive the same result as what is stated below. I accept the settings displayed in this dialogue box by selecting the button labelled "OK". The IDE appears to show me all of the Gradle build files that were altered by the addition of the Kotlin library to them, but does not appear to alter the Ja...

Which time-complexity is better O(logM + logN) or O(logM.logN)?

I tried the binary search on the 2D matrix and I got the solution which gives the time compexity to be the O(logN.logM). There exist already a solution which performs it in log(MN) time. I Only want to know which is better or less-time taking. Really a burning question.

Reference to array of objects in Sanity

Im having issues with references in Sanity. Im setting some color themes in the root of my Sanity schema: defineField({ name: 'articletheme', title: 'Article theme', description: 'Create 4 themes for article blocks', type: 'array', validation: (Rule) => Rule.required(), of: [{ type: 'articleThemeBlock' }], }), In one of the blocks I would like to reference the theme array to select which color theme that block should use. Ive tried this, but it fails: defineField({ name: 'theme', title: 'Theme', type: 'reference', to: [ { type: 'array', of: [ { type: 'articletheme', }, ], }, ], }), Any suggestions?

How to compare variable name and button id to load content inside variable for ThreeJS?

I am using Three.js to load multiple 3D models and store them in an array in the background. I've multiple buttons with unique ID add that specific model to scene. Now I want to compare the button ID and variable name so that I can load only that specific model and remove any other models added to the scene. I have written a for loop to to loop through all the variable to compare with ID of the clicked button, but I'm not able to access only variable name so that I can compare it with button ID. Following is my code : function modelShow() { let m; var models = [mandi_0, maxi_0, mandi_1, maxi_1, mandi_2, maxi_2]; for (m = 0; m < models.length; m++) { if(models[m].name == event.target.id){ scene.add(models[m]); } else { scene.remove(models[m]); } } } let j; for (j = 0; j < buttons.length; j++) { buttons[j].addEventListener('click', modelShow); } How can I compare only variable name with button ID and not the content...

How do I mirror an NSAttributedString with an icon and text in right-to-left mode

Image
I have a UIButton that holds an NSAttributedString that contains an icon (which is an NSAttributedString itself) followed by a text. It looks something like this: I want to make it look like this when the device is configured for an RTL language (e.g. Arabic, Hebrew): The string is built like this: var iconText = NSAttributedString(fontName: fontName, fontSize: fontPointSize, fontValue: fontValue, color: color ?? iconColor) let iconTextRange = NSRange(location: 0, length: iconText.count) let iconAttrs: [NSAttributedString.Key: Any] = [.font: icon.font(pointSize: pointSize), .foregroundColor: iconColor] if !text.isEmpty { iconText = "\(iconText) \(text)" } let attributeString = NSMutableAttributedString(string: iconText, attributes: textAttrs) attributeString.addAttributes(iconAttrs, range: iconTextRange) return attributeString As you can see, first the icon is created using a font, then it's concatenated to t...

Unable to Send Word Mail Merge Email in VBA Due to Word File not Opening

I have a table in access and a Word mail merge setup and linked to the table. I would like my customers to receive an email on a specific date stated in the table. I have created a template in word and started the mail merge process using the step-by-step mail merge wizard ready for VBA to send the email. I have tried this VBA code in Access, but it just keeps crashing and I think it is because it can't open the Word file. I am sure of this as I commented out the code line by line and it only crashed when I put Set wdDoc = wdApp.Documents.Open("C:\Users\Adam Khattab\Documents\Mail Merge - Copy.docx") . I reviewed this this post, however, this is specifically for Access and not Excel. Option Compare Database Sub SendEmailsWord() Const wdSendToEmail As Long = 0 Const wdMailFormatPlainText As Long = 2 On Error GoTo ErrorHandler 'Declare variables Dim wdApp As Word.Application Dim wdDoc As Word.Document Dim strSQL As String Dim rst As DAO.Recordset 'Set th...

How to transfer ERC1155 token using web3 Python?

I believe this subject will help many other people, i searched a lot and did not find anything clear. I've been researching this for days, but i can't find a solution. I need to transfer an ERC1155 token using python. Something very simple, send token from account1 to account2 using python. Token: ERC 1155 Network: Polygon Language: Python Could someone please leave an example how to do it. Thanks from web3 import Web3 import json rpc_polygon = "https://polygon-rpc.com" web3 = Web3(Web3.HTTPProvider(rpc_polygon)) # print(web3.isConnected()) account_1 = "FROM_ADDRESS" account_2 = "TO_ADDRESS" private_key = "PRIVATE_KEY_HERE" balance = web3.eth.get_balance(account_1) humanReadable = web3.fromWei(balance, 'ether') print(f'balance: {humanReadable}') nonce = web3.eth.get_transaction_count(account_1) # print(f'nonce: {nonce}') ABI = json.loads('[{"inputs":[{"internalType":"add...

Acquire/Release Visibility of Latest Operation

There is a lot of subtlety in this topic and so much information to sift through. I couldn't find an existing question/answer that specifically addressed this question, so here goes. If I have an atomic variable M of type std::atomic_int , where Thread 1 performs M.store(1, memory_order_release) Later, Thread 2 performs M.store(2, memory_order_release) Even later, Thread 3 M.load(memory_order_acquire) Is there any legitimate scenario in which Thread 3 could read the value 1 instead of 2 ? My assumption is that it is impossible, because of write-write coherence and happens-before properties. But having spent an hour going over the C++ standard as well as cppreference , I still can't form a concise and definitive answer to this question. I'd love to get an answer here with credible references. Thanks in advance.

How can I loop a nested json and show all the data in the laravel blade

Actually I am having trouble looping a complex JSON. look at this JSON structure. { "transactionId": "blablablabla", "campaigns": [ { "affiliateNumbers": [ { "phoneNumber": "+345345", "localNumber": "(888) 34534534534-456456", "displayNumber": "6345345345", "assignmentSettings": { "countryCode": "US", "isTollFree": true, "limit": 5 }, "deallocFlag": false, "failedRechargeAttempts": 0, "isCarrierNumber": false, "carrierNumberId": "", "isInternalOnly": false, ...

Identity Db Context Get Null In Web API

I have created API in .net 7.0, I have EF core with IdentityDbContext . Problem is when I am going to find user by user manager as below get null exception. System.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot be called on Null values. at Microsoft.Data.SqlClient.SqlDataReader.GetFieldValueFromSqlBufferInternal\[T\](SqlBuffer data, \_SqlMetaData metaData, Boolean isAsync) at Microsoft.Data.SqlClient.SqlDataReader.GetFieldValueInternal\[T\](Int32 i, Boolean isAsync) at Microsoft.Data.SqlClient.SqlDataReader.GetFieldValue\[T\](Int32 i) I have tried to get user in login action. [HttpPost] [Route("login")] [AllowAnonymous] public async Task<IActionResult> Login([FromBody] LoginModel model) { var user = await userManager.FindByNameAsync(model.UserName); if (user != null && await userManager.CheckPasswordAsync(user, model.Password)) { var userRoles = await userManager.GetRolesAsync(user); var authCl...

How Next.js useRouter() handle the mapping variable?

const router = useRouter(); return ( <> {Usercategory.map((user,index)=>{ return <div className='user-li' key={index} onClick={()=>{router.push(user.link)}}> <li> {user.icon} </li> <li> <span>{user.name}</span> <span>{user.entry}</span> </li> </div> })} </> ) } On above , onClick={()=>{router.push(user.link)} Couldn't work ? How can I finish this? Thanks

Return np.average from masked numpy array [closed]

Fisheye All Sky Images Idea: Only Calculate with Sky Area Pixels (Solarpoweranalysis) e.g. static circle def get_sky_area(radius, centre, image_name): img = Image.open(str(image_name)) cv2_img = np.array(img) cv2_img = cv2.cvtColor(cv2_img, cv2.COLOR_RGB2BGR) sky = cv2_img.copy() mask = np.zeros(sky.shape[:2], dtype="uint8") cv2.circle(mask, centre, radius, 255, -1) # apply the mask to our image masked = cv2.bitwise_and(sky, sky, mask=mask) avgR = np.mean(masked[:,:,0]) avgG = np.mean(masked[:,:,1]) avgB = np.mean(masked[:,:,2]) print("Mean of channel R: ", avgR) print("Mean of channel G: ", avgG) print("MEan of channel B: ", avgB) #cv2.imshow("sky", sky) #cv2.imshow("mask", mask) #cv2.imwrite('sky_image.png', masked[:,:,2]) print("Saved Sky image as sky_image") #cv2.imshow("Mask applied to image", masked) #cv2....

python compare strings return difference

Consider this sample data: str_lst = ['abcdefg','abcdefghi'] I am trying to write a function that will compare these two strings in this list and return the difference, in this case, 'hi' This attempt failed and simply returned both strings. def difference(string1, string2): # Split both strings into list items string1 = string1.split() string2 = string2.split() A = set(string1) # Store all string1 list items in set A B = set(string2) # Store all string2 list items in set B str_diff = A.symmetric_difference(B) # isEmpty = (len(str_diff) == 0) return str_diff There are several SO questions claiming to seek this, but they simply return a list of the letters that differ between two strings where, in my case, the strings will have many characters identical at the start and I only want the characters near the end that differ between the two. Ideas of how to reliably accomplish this? My exact situation would be a list of very s...

Sweetalert2 text property doesn't pass ngModel value

Hello i am trying to pass a value (1 or 2 or 3) from input using NgModel through Sweetalert2 and it's text property but the value is always 0 Any help? here is the code reason: number = 0; btn1: any; btn2: any; btn3: any; const steps = ['1', '2', '3'] const Queue = Swal.mixin({ progressSteps: steps, backdrop:false, confirmButtonText: 'Next >', customClass: 'height-auto', // optional classes to avoid backdrop blinking between steps showClass: { backdrop: 'swal2-noanimation' }, hideClass: { backdrop: 'swal2-noanimation' } }) await Queue.fire({ title: '<b style="font-size:17px!important;">' + this.translation.first_select_why_you_want_to_block_this_member + '</b><br />', html: '<br /><ion-textx [(ngModel)]="btn1" [n...

Convert Linq operation syntax to query syntax

I'm trying to figure out how to convert this method syntax into query syntax: result.Select(c => { c.property1 = 100; return c; }).ToList();

Stream/Encode videos using Azure Media Services and Node Js

I have an application that uses AWS Elastic Transcoder to encode videos uploaded to S3 buckets into HLS streaming formats using Lambda functions : var AWS = require('aws-sdk'); var eltr = new AWS.ElasticTranscoder({ apiVersion: '2012–09–25', region: 'ap-south-1' }); exports.handler = function (event, context) { var key = event.Records[0].s3.object.key; let srcKey = decodeURIComponent(key.replace(/\+/g, " ")); //the object may have spaces let newKey = key.split('.')[0].replace('protected-video-input/', '') eltr.createJob({ PipelineId: pipelineId, OutputKeyPrefix: 'protected-video-output/' + newKey + '/', Input: { Key: srcKey, FrameRate: 'auto', Resolution: 'auto', AspectRatio: 'auto', Interlaced: 'auto', Container: 'auto' }, Outputs: [ ...

Deploy ERC20Upgradeable without Proxy for governable upgrades

I've created an UUPS upgrade able token (minified for the example) contract GovernanceToken is Initializable, ERC20Upgradeable, ERC20PermitUpgradeable, ERC20VotesUpgradeable, OwnableUpgradeable, UUPSUpgradeable { /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize() initializer public { __ERC20_init("GovernanceToken", "GT"); __ERC20Permit_init("GovernanceToken"); __ERC20Votes_init(); __Ownable_init(); __UUPSUpgradeable_init(); } //... } My deploy script looks like this: const deployGovernanceToken: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // @ts-ignore const { getNamedAccounts, deployments, network } = hre const { deploy, save, log, get } = deployments const { deployer } = await getNamedAccounts() const governanceTokenContractFactory = await ethers.getContractFactory(GOVERNANCE_TOKE...

Android app xml resources with variable in it?

Is there a technique to implement the Android app xml resources with variable in it? For example: I have a app resource, i.e., res/drawable/rounded_corners.xml: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="@android:color/holo_blue_dark" /> <corners android:radius="10dp" /> </shape> It works, but I need to change the color in the runtime without creating a lot of similar resources like this just with different colors.

Disable form field google script

I have a link that leads to a prefilled Google form, the prefilled form is editable and user can change the entries I added a note not to change anything but of course user still has a capability to change it if they want to. Is there a way to lock or restrict the user from editing the prefilled form? The user need to see the fields with the prefilled content, but they should not be able to edit/modify it.

Network Graph is displayed without colored nodes

I am trying to run the DSATUR algorithm on a graph but the problem is that the result is displayed with the default color. Dsatur is an algorithm that colors the vertices that have the highest degree of saturation, that is to say that it is the vertex that has the maximum number of colored neighbors. The algorithm I use comes from the NetworkX documentation, i tried another algorithm like the 'strategy_largest_first' which returns the list of nodes in decreasing order by degree and it works like so many other algorithms dealing with graph problems. So I think the problem might comes from how I display my graph, i.e. nx.draw(G, with_labels=True). import matplotlib.pyplot as plt import networkx as nx import tkinter from tkinter import * node_colors = { 0: (255, 0, 0), 1: (0, 255, 0), 2: (200, 20, 128), 3: (127, 127, 127), 4: (152, 53, 91), 5: (44, 200, 100), 6: (100, 44, 200), 'null': (0, 0, 0), # Default Color 'OOB': (180, ...

Sankey diagram with ggplot

Image
I am relatively experienced in pivoting tables, however this one is almost driving me mad. I want to generate a Sankey plot with flows connecting parameters between two experiments. This is very simple, yet I cannot figure out how the package wants the data laid out. Please consider the following MWE: tribble( ~parm, ~value, "b1", 0.009, "g1", 0.664, "b2", 0.000, "ra", 0.000, "rc", 0.000, "ax", 0.084, "cx", 0.086, "ex", 0.179, "ay", 0.045, "cy", 0.043, "ey", 0.102 ) -> doc1 doc2 <- tribble( ~parm, ~value, "b1", 0.181, "g1", 0.289, "b2", 0.181, "ra", 0.000, "rc", 0.000, "ax", 0.001, "cx", 0.001, "ex", 0.002, "ay", 0.001, "cy", 0.001, "ey", 0.002, "re", 0.000, "rf", 0.000, "b3", 0.289 ) doc1 <- doc1...

Remove OR replace faulty paragraph marks using VBA macro

Image
I have some faulty paragraphs, which are causing my other macros to not work properly. They are usually heading style 2, style 3 Empty (not sure) before OR after table (not sure) surrounded by dotted line causes the heading and next table to merged together (not sure) I tried to replace/removed those with the following macro: Sub HeadingParaBug() Dim H As Range Set H = ActiveDocument.Range LS = Application.International(wdListSeparator) With H.Find .Text = "^p " .Replacement.Text = "^p" .Execute Replace:=wdReplaceAll .Text = " ^p" .Replacement.Text = "^p" .Execute Replace:=wdReplaceAll .Text = "^p ^p" .Replacement.Text = "^p^p" .Execute Replace:=wdReplaceAll .Text = "^13{2" & LS & "}" .Replacement.Text = "^p" .MatchWildcards = Tru...

Modify daqapo::detect_value_range_violations to generate different result

I have the activitylog object below: hospital<-structure(list(patient_visit_nr = c(510, 512, 510, 512, 512, 510, 517, 518, 518, 518, 519, 519, 520, 519, 521, 521, 519, 522, 522, 523, 524, 525, 526, 523, 527, 527, 527, 528, 528, 523), activity = c("registration", "Registration", "Triage", "Triage", "Clinical exam", "Clinical exam", "Triage", "Registration", "Registration", "Registration", "Registration", "Triage", "Trage", "Clinical exam", "Triage", "Registration", "Treatment", "Registration", "Triaga", "Registration...

How to fix twitching/braking while scrolling website vertically up and down on iphone in safari

Tried many things, but still no results. Please help me to get rid of awful scroll effect which is twitching/braking while scrolling website vertically up and down. My website: https://evgeniyr1987.github.io/VisitCardPortfolio/ , you can play that twitching/braking scroll effect on iphone and safari only, anywhere else works perfect! Here is the link to video for better understanding https://disk.yandex.ru/i/yck8jAbU7fBAtw .

algo - light illumination value mapping

Consider this board map : we have a board of m x n size, there are light bulbs with varying power installed in different cells on the map, 1 light bulb only per cell. if a bulb has power index of 10, then a cell whose shortest distance from the bulb is 4 cells away will receive 10 - 4 = 6 illumination index from the bulb. for example, look at this initial stage a light bulb with 7 illumination index is located in row 2 col 2 will illuminate cell in row 1 col 4 at 3 illumination index. if a cell receives illumination from multiple light bulbs, the one with highest illumination index wins. for this board, the final state will look like this: final state another example of a light bulb with illumination power of 10 placed at the center of the map example once the illumination power hits 0, no adjacent cell will be illuminated. what I have in mind is to check each non-lightbulb cell on the board against each light bulb to determine the final illumination point on that cell. Is there ...

getting error : HTTPerror: basic auth header is Invalid ,when sending files to ipfs

const projectId = process.env.PROJECTKEY const projectSecret =process.env.SECRETKEY const auth = 'Basic' + Buffer.from(projectId + ":" + projectSecret).toString('base64') const client = IPFSHTTPClient({ host:'infura-ipfs.io', port:5001, protocol:'https', headers:{ authorization: auth } }) i removed headers object and then got error- project id required

In RStudio, how to print tibble in quarto/rmarkdown chunk as in console?

Image
When editing quarto/rmarkdown documents, I would like RStudio to display inline tibbles the same way as it does in the console, instead of the paginated default printing. Instead of this: I would much prefer the output from the console: # A tibble: 150 × 5 Sepal.Length Sepal.Width Petal.Length Petal.Width Species <dbl> <dbl> <dbl> <dbl> <fct> 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa 5 5 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa 7 4.6 3.4 1.4 0.3 setosa 8 5 3.4 1.5 0.2 setosa 9 4.4 2.9 1.4 0.2 setosa 10 4.9 3.1 1...

Untar specific files using lambda

I'm using a lambda function to untar files. The lambda is supposed to untar files and once it's done it moves the package to an archive folder. Code below def untar_file(zip_key,source_bucket,source_path,file): zip_obj = s3_resource.Object(bucket_name=source_bucket,key=zip_key) buffer = BytesIO(zip_obj.get()["Body"].read()) with tarfile.open(fileobj=buffer, mode=('r:gz')) as z: for filename in z.getmembers(): s3_resource.meta.client.upload_fileobj( z.extractfile(filename), Bucket=source_bucket, Key=source_path+f'/{d1}/{filename}.csv' ) copy_objects (zip_key,source_bucket,source_path,file) I want to only untar specific files in the package. Can I specify which file to not untar ? Just to avoid the lambda timeout

How to append to file before specific string in go?

I have a file that starts with this structure: locals { MY_LIST = [ "a", "b", "c", "d" //add more text before this ] } I want to add in the text "e" before the "//add more text before this" and "," after the "d" so it will be like this: locals { MY_LIST = [ "a", "b", "c", "d", "e" //add more text before this ] } How can I implement this dynamically so that I can add more strings to the file in the future? Thanks

svelte rollup-plugin-css-only import not working

In a svelte project, I want to import some css files, and I cant make this plugin works : https://github.com/thgh/rollup-plugin-css-only here is my config project/rollup.config.js /* other imports */ import css from 'rollup-plugin-css-only'; export default { plugins: [ /* svelte here, */ css({ output: 'public/build/extra.css' }), /* alternatives I tried : css(), css({ output: 'extra.css' }), css({ output: 'bundle.css' }), css({ output: 'public/build/bundle.css' }), */ ] }; I put intentionally the output in a separate file project/public/build/extra.css instead of the default project/public/build/bundle.css to see if the file will be created; and the file is never created I searched with find . -type f -name "*extra.css" in the project root directory the output file is included inside the project/public/index.html : <link rel='stylesheet' href='/build/extra.css'>...

Set the GUID value of VSTO AddIn

Image
I don't understand how i can set the GUID value of a VSTO AddIn. In EventViewer i see Empty GUID: {00000000-0000-0000-0000-000000000000}. I've tried using the Guid and ProgId attributes on the ThisAddIn class, but that doesn't help. Can you please tell me how to change the GUID.

A coredata computed property used to sort an array of object is not updated. Working when I go from view1 to view2, but not from view 3 to view2

I am still quite new at SwiftUI and I am having trouble to understand why the array that I have created in my model “GameSession”, which is sorted according to a computed variable defined in my second model “GamePlayer”, is not “always” correctly updated. I have simplified my code to make it more readable, in order to maximize the chances of someone helping me! Description of my code : In my App, I have 2 entities 1.     GameSession  :which has Attributes "date", "place", "nbplayer" + a relationship called "players" with " GamePlayer " 2.     GamePlayer : which has Attributes "name","scorelevel1","scorelevel2","scorelevel3" + a relationship with "GameSession" the relationship is "one to many": One GameSession   can have many GamePlayer   And basically, I have 3 views: View 1: Just one navigation link which brings you to View2 View2: Display a list of “Game” played ...

Changes are not reflecting in azure app service after deploying via azure devops pipeline

I have a CI/CD pipeline in the Azure DevOps pipeline that deploys the app into the Azure App Service. Both the build and release pipelines are executing without any errors. Before some days, the deployed changes were working fine but now the changes are not reflecting even though the pipeline is executing without any errors. Release pipeline definition: https://prnt.sc/UE1039_bI6Tz While analyzing the release pipeline, in the 'Deploy azure app service' task it shows, Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters changed build pipeline debug log file: https://drive.google.com/drive/folders/1ReX_rCuqANfvmFrfHb7es-CiU7GxDEPf?usp=share_link release pipeline debug log file: https://drive.google.com/file/d/1xrokn_itGWMKqcKRMIRf-OigRhJOHvVp/view?usp=share_link I checked the artifact created in build pipeline and the changes are there in artifact. But in the release pipeline the changes are not refelected. I checked in the kudu console and the changes are not there...

How to match more than 2 side by side

I'm currently using python and having trouble finding a code. I have 2 data frames that I would like to match more than 2 numbers that match side by side. For example, I would like to lookup the numbers in df1 and find more than 2 numbers match side by side in df2. import pandas as pd cols = ['Num1','Num2','Num3','Num4','Num5','Num6'] df1 = pd.DataFrame([[2,4,6,8,9,10]], columns=cols) df2 = pd.DataFrame([[1,1,2,4,5,6,8], [2,5,6,20,22,23,34], [3,8,12,13,34,45,46], [4,9,10,14,29,32,33], [5,1,22,13,23,33,35], [6,1,6,7,8,9,10], [7,0,2,3,5,6,8]], columns = ['Id','Num1','Num2','Num3','Num4','Num5','Num6']) I would like my results to be something like this. results = pd.DataFrame([[6,1,6,7,8,9,10]], columns = ['Id', 'Num1','Num2','Num3','Num4',...

Looking for a self contained simple c# example of FFmpeg AutoGen encoding

Image
I'm unable to get the FFmpeg.AutoGen.Example code to work in my own project. The example has the FFmpeg.AutoGen.Abstractions project as a dependency. I can't figure out how to replicate or reference it in my project. The only other example that I can find has data elements that Visual Studio isn't able to resolve. The FFmpeg.AutoGen.Bindings.DynamicallyLoaded project is referenced in the same way but I was able to compile it and add the DLL as an assembly in my project. When I do the same for the Abstractions class, the data classes defined in it weren't equivalent to the FFmpeg.AutoGen data classes. It's like I need a reference to Abstractions in FFmpeg.AutoGen but it's not there.

How to create a automatic pop up in wordpress either through plugin or by coding

I have developed a website on wordpress and the requirement for website backend admin panel is that the order details automatically get poped up when any new order is recieved on website without clicking any button. I am not able to change the source file of the plugin or theme. If someone can help me out in adding that code to the plugin or theme.

How to get host where problem appears Zabbix-api

I'm trying to make a script on Python, which works with zabbix-api. For example: Trigger worked, problem appears and then I make an "action trigger", which will work on that host, where problem appeared. For the script, I need to get host (and host id), where problem appeared and then resolve the problem. But I don't know how to get only this host. Please, could you help me with this or maybe give me some advice, what am I doing wrong? I tried something like: my_host = zabbix_log.host.get(limit=1, output=["hostid", "name", "host"])[0] Of course, it works, but I understand, that this is only give to me some random host, and not the host where problem appeared

Boost static linking to custom library somehow broken (Windows)

I am trying to build a Library (MyLib) that has a static dependency to boost. However, when I am trying link MyLib to an Application I will get linking erorrs saying that boost functions cannot be found. I did used the pointer to implementation idiom. Conan installed the static lib of boost (I checked that). The plattform is windows. Does anyone has an idea what I am doing wrong? Here is the CMakeLists.txt cmake_minimum_required(VERSION 3.24) set(TARGET_NAME MyLib) project(${TARGET_NAME}Project) include(${CMAKE_CURRENT_LIST_DIR}/build/conanbuildinfo.cmake) conan_basic_setup() set( SRC_FILES src/FileA.cpp src/FileB.cpp src/FileC.cpp ) add_library(${TARGET_NAME} ${SRC_FILES}) target_include_directories( ${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include/public PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include/private ) target_link_libraries(${TARGET_NAME} PRIVATE ${CONAN_LIBS_STATIC}) set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 17) insta...

How does firebase authentication work with ionic and capacitor?

When the app is launching for the sign in page, an error is occurring that relates to the authorized domains: Cross-origin redirection to http://developers.google.com/ denied by Cross-Origin Resource Sharing policy: Origin capacitor://localhost is not allowed by Access-Control-Allow-Origin. Status code: 301 When I try to add capacitor://localhost to the list of authorized domains, it throws the error A valid domain name is required (e.g. 'myapp.com') My authentication code both has a listener: useEffect(() => { const unsubscribe = onAuthStateChanged(auth, async (userInfo) => { setUser(userInfo); if (userInfo === null) { localStorage.clear(); history.push("/login"); } else { const token = await userInfo.getIdToken(true); history.push("/home"); localStorage.setItem("AuthToken", `Bearer ${token}`); } }); return unsubscribe; }, [user, history]); and the sign in f...

How to use React-datepicker with custom data

I am trying to make a custom react-datepicker but my code is not working correctly. const [filterDateFrom, setFilterDateFrom] = useState(""); const [filterDateTo, setFilterDateTo] = useState(""); const [startDate, endDate] = filterDateFrom && filterDateTo; then I have a function to pull the date and my return is something like: <div> <DatePicker filterDateFrom={true} filterDateTo={true} startDate={startDate} endDate={endDate} onChange={(update) => { setFilterDateFrom(update) && setFilterDateTo(update) }} withPortal /> </div> But when I select the dates the code breaks. The DatePicker on the official documentation looks like this: <DatePicker selectsRange={true} startDate={startDate} endDate={endDate} onChange={(update) => { setDateRange(update); }} /> Any ideas? Here is a snippet from my JSON file: [ { "id": 1, "Peri...

WÄ°NDOWS FORM c# How to detect empty space in datagridview and warn the screen if it is empty? [closed]

Image
I want only 3 of the columns in my table in Datagridview1 not to be empty. I want it to warn the screen when there is an empty field. I tried to make a mandatory field to be filled in the datagridview1 table When I add other data to the data I pull from sql in Datagridview, I want it to warn the screen to be filled if there should be no empty space. As you can see in the photo below, only those places should not be empty, and when I press save, it should detect when there is an empty space and give a warning to the screen. give a warning if there is free space

Converting list of string into dataframe row

I have the following continent to country pd.DataFrame({'asia':[['china','india','australia']], 'europe':[['spain','uk','russia','france','germany']], 'americas':[['canada','usa','mexico']] }).transpose() How do I convert into asia | china asia | india asia | australia europe | spain europe | uk etc. .

Json contains with exclusion or wildcard

Is there a way to either wildcard or exclude fields in a json_contains statement (postgres w/ sqlalchemy)? For example, lets say one of the rows of my database has a field called MyField which has a typical json value of ... MyField : {Store: "HomeDepot", Location: "New York"} Now, I am doing a json contains on that with a larger json variable called larger_json ... larger_json : {Store: "HomeDepot", Location: "New York", Customer: "Bob" ... } In sqlalchemy, I could use a MyTable.MyField.comparator.contained_by(larger_json) and in this case, that would work fine. But what if, for example, I later removed Location as a field in my variable... so I still have the value in my database, but it no longer exists in larger_json : MyField : {Store: "HomeDepot", Location: "New York"} larger_json : {Store: "HomeDepot", Customer: "Bob" ... } Assume that I know when this happens, i.e. I know that the...

How to convert two's complement to an int - using C?

I'm trying to read a register from an INA260 using a Pico microcontroller . My program is in C. The register I'm having trouble with contains the value of the electrical current measured by the INA260. Since the INA260 accommodates measurement of current flowing in either direction, the mfr decided to cast the two bytes of measurement data in two's complement . This allows for a "negative" current - meaning only that the current is flowing in one direction instead of the other. I can appreciate this is a clever solution from a hardware perspective, but from the software perspective, I am very fuzzy on two's complement . In an effort to help frame my question & give it some context, here's how I read & process the INA260's measured electrical current in the designated register. This code may not be elegant, but it gives the correct answer: uint8_t rcvdata[2]; /* Read the Current Register (01h); INA260_MILAMP_REG _u(0x01) */ reg =...