By Jonathan Lauwers on Jun 05, 2021 04:02 am For my current use case, I have to set the inner html of my element programatically due to it using markdown: <div className='quote-copy' dangerouslySetInnerHTML={{ __html: body?.childMarkdownRemark?.html, }} /> In this element, I have to make sure a quote icon appears over the first two lines of the set paragraph like this: However, when trying this, I only managed to get it working on the first line of the paragraph like this: By using the following code in my scss file: .quote-copy { > :first-child { &::before { content: ''; overflow: hidden; display: inline-block; background: url('../../../assets/icons/quote.svg') no-repeat center; object-fit: contain; width: 60px; height: 40px; background-size: 60px 40px; } } } Does anyone know how I can make the quote icon appear over the first two lines of copy? Read in browser »  By user999 on Jun 05, 2021 04:02 am In google cloud platform, i am trying to restrict firebase api keys to my react native app, which is now published on playstore. but failed to restrict api keys to app. After adding credentials of apps i cannot login to my app which i have downloaded from playstore. If i remove restriction i can login to my app. I have done following things in gcp below is the image.
Read in browser »  By ReaderGuy42 on Jun 05, 2021 04:01 am I've been using gImageReader for a few years and I've always used it to export the OCR'ed text as an invisible text layer over the existing pdf scan, resulting in a searchable pdf file, which is useful for research, working with the text etc. I was doing this on Windows 10, and recently installed a dual boot with Linux Mint and reinstalled Windows due to slow-down. Now I reinstalled gImageReader and I can no longer find the option to export to PDF with text layer. In fact I'm having trouble even finding much mention of said function online. I don't know if I originally installed some fork or beta or what, but the way the (probably) official version of the program looks is not what I'd been using so far. I was always able to set certain post-production parameters, such as size of the invisible text etc. Any ideas where I could find that version again? I'd prefer a Linux Mint compatible version, but Windows would also be fine, if that's the only one. Thanks! Read in browser »  By schwindelig on Jun 05, 2021 04:00 am Assume we have the following entities: - User Agent (Browser)
- IDP
- Web Application (SP1)
- Resource Portal (SP2)
The goal is to have the Web Application (SP1) being a "Front End" for the User, allowing them to access Resources through the Web Application (SP1) from the Resource Portal (SP2), without the user directly interacting with SP2. SP1 would therefore act as a kind of "Proxy" for SP2 and impersonate the logged-in user for the proxied requests. Does SAML support this kind of use case? Is there any way to propagate the Security Context which was established on SP1 to SP2 (or any other mechanism that would allow the impersonated requests)? Based on my current understanding, the user would still need to establish a security context for SP2. Read in browser »  By Muhammad Mubashir on Jun 05, 2021 04:00 am I am a beginner. I am making a website with react.js as frontend and flask as backend. I have used flask-login to manage the login in the backend. I have made public and private routes in my react app which work when a state "isLogged" is true or false. In order to set that state to true or false, I am fetching data from my flask backend endpoint "/isloggedin", which looks like this: @app.route("/isloggedin") def isLogged(): if current_user.is_authenticated: return jsonify({"isLogged": True}) else: return jsonify({"isLogged": False}) but the return is always "false", even when the user is signed in. Also, when I fetch from the "/login" endpoint of flask app, I am unable to set the "login_user()" property of flask-login. However, when I use any Online API testing website, I get the right results and the "/isloggedin" endpoint also returns the right data. Somebody, please explain what I am doing wrong? Read in browser »  By Валентин Д. on Jun 05, 2021 03:54 am I want to access only the integer in this arraylist so i can compare the note with other number. prs is the name of arraylist of type Student that contains integer and String. try { input = Integer.parseInt(JOptionPane.showInputDialog("Ecrivez une note")); for(Student st:prs) { int i=0; if(prs.get(i).equals(input)) { JOptionPane.showMessageDialog(null,prs.get(i)); }
Read in browser »  By user3188445 on Jun 05, 2021 03:48 am I'm trying to understand the algorithm that clang and gcc use to expand recursive macros in C/C++, and specifically whether they follow Prosser's algorithm. I understand that there are other questions on stack overflow discussing how to write recursive macros. This question is about how to implement a C preprocesser that supports recursive macros. None of the answers I've seen on stackoverflow specifically addresses whether the compilers are using Prosser's algorithm or something else (and if so, what the other algorithm is). Here's a minimal working example: #define ID(arg) arg #define EMPTY #define NOEXPAND(macro) macro EMPTY #define F_AGAIN() F #define F() f NOEXPAND(F_AGAIN)()() F() // expands to: f F_AGAIN ()() ID(F()) // expands to: f f F_AGAIN ()() ID(ID(F())) // expands to: f f f F_AGAIN ()() My questions: Are these macro expansions consistent with Prosser's algorithm? (Everybody talks about Prosser's algorithm, but I can't find a way to interpret the algorithm consistent with the above expansions.) If these expansions are consistent with Prosser, what are the hide sets of the tokens at each stage of expansion of ID(ID(F())). If not, what is the algorithm used by the compilers, and where is it documented? Read in browser »  By sachin.g on Jun 05, 2021 03:47 am I am designing a schema where input fields will change based on job description dropdown. I wanted to know whether below schema design is correct way to do it or any other options are there. My mongoose schema const coolingSchema = new Schema({ origin_id: { type: ObjectId, ref: 'Origin' }, lot_id: { type: ObjectId, ref: 'Lot' }, date: { type: Date, required: true }, job_description: { type: ObjectId, ref: 'jobDescription' }, value: [{ type: ObjectId, ref: 'questionMaster' }] }) const jobDescriptionSchema = new Schema({ name: { type: String, required: true } }) const questionMasterSchema = new Schema({ desc_id: { type: ObjectId, ref: 'jobDescription' }, key: { type: String, required: true }, name: { type: String, required: true } }) Here question masters desc_id can be of multiple desc_id.Each description can have same or different set of questions. My post object { "origin_id": "1", "lot_id": "1", "date": "2021-06-01", "job_description": "1", "values": [ { "key": "field1", "label": "Field 1", "value": "0.0-0.0" }, { "key": "field2", "label": "Field 2", "value": "0.0-0.0" }, { "key": "field3", "label": "Field 3", "value": "0.0-0.0" }, { "key": "field4", "label": "Field 4", "value": "0.0-0.0" }, { "key": "field5", "label": "Field 5", "value": "0.0-0.0" }, { "key": "field6", "label": "Field 6", "value": "0.0-0.0" }, { "key": "field7", "label": "Field 7", "value": "0.0-0.0" }, { "key": "field8", "label": "Field 8", "value": "0.0-0.0" } ] }
Read in browser »  By vettel hamilton on Jun 05, 2021 03:41 am I was wondering why to use so many HTML tags. Just have a look below at the code where I have used a div tag : <!DOCTYPE html> <html> <body> <h2> HTML nav Tag</h2> <!-- nav tag starts --> <div> <a href="#">Home</a> | <a href="#">Interview</a> | <a href="#">Languages</a> | <a href="#">Data Structure</a> | <a href="#">Algorithm</a> </div> <!-- nav tag ends --> </body> </html> It's output is: Now if I use the nav tag instead of the div tag , I get the same output: <!DOCTYPE html> <html> <body> <h2> HTML nav Tag</h2> <!-- nav tag starts --> <nav> <a href="#">Home</a> | <a href="#">Interview</a> | <a href="#">Languages</a> | <a href="#">Data Structure</a> | <a href="#">Algorithm</a> </nav> <!-- nav tag ends --> </body> </html> Output is: If the the outputs are the same then why use nav instead of div (or why to use tags like body,main,article etc if div does the job). Read in browser »  By Humberto Barrera on Jun 05, 2021 03:19 am I'm new in PostgreSQL. I'm trying to create a logical replication of 2 databases that are in the same localhost and port (I don't know if that's part of the problem that I'm having). The point is, that I create the publication with no problem, but, the moment that I create the subscription, the replication slot that must be created in the master won't create. I have the wal_level = logical, but I don't know if I need another configuration in the pg_hba Another detail is that I can't create the subscription by code, Postgres just simply doesn't respond, like it got stuck right there, doesn't show any error message or confirmation. The only way I can create the subscription is in pgAdmin 4, but here occurs the error that the replication slot it doesn't create. Any suggestion of help is accepted. And btw, sorry if my english is kind of bad, I hope I have explained myself. Read in browser »  By Amit Yadav on Jun 05, 2021 03:03 am Looking for help to call a JavaScript function written in third party app from django html page to send a message about an event to the same third party application, I have no idea about JavaScript. js function to be called window.purpose.Message({ type: 'collection' }, {accesstoken: '1234rr55r3'},'*'); html page in which this js function needs to be called <!DOCTYPE html> <html> <head> <title>User Redirect</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body onload="document.frm1.submit()"> <form action="{{url}}" name="frm1" method="post"> #some code </form> </body> </html>
Read in browser »  By Meskaj on Jun 05, 2021 02:52 am I am new to time complexity, could you help me to solve this simple example in a more efficient way? I have the price of the stock as S for N days. I only can do one transaction. How can I maximum the profit? In the following example, the best way is to buy at 1 and sell at 7. Thank you in advance. S = [8,1,2,5,7, 3, 1] N = len(S) profit = max([max(S[i+1:N])-S[i] for i in range(N-1)]) if profit < 0: print(0) else: print(profit)```
Read in browser »  By 2950_Rutuja Wasu on Jun 05, 2021 02:14 am why is time complexity in inorder , preorder and postorder traversal of a tree O(n)? What is it for AVL tree? As avl tree is balanced does time complexity change as compared to bst? Read in browser »  By Andre on Jun 05, 2021 01:20 am I want to add a DataFrame a (containing a loadprofile) to some of the columns of another DataFrame b (also containing one load profile per column). So some columns (load profiles) of b should be overlaid withe the load profile of a. So lets say my DataFrames look like: a: P[kW] 0 0 1 0 2 0 3 8 4 8 5 0 b: P1[kW] P2[kW] ... Pn[kW] 0 2 2 2 1 3 3 3 2 3 3 3 3 4 4 4 4 2 2 2 5 2 2 2 Now I want to overlay some colums of b: b.iloc[:, ] += a.iloc[:, 0] I would expect this: b: P1[kW] P2[kW] ... Pn[kW] 0 2 2 2 1 3 3 3 2 3 3 3 3 4 12 4 4 2 10 2 5 2 2 2 but what I actually get: b: P1[kW] P2[kW] ... Pn[kW] 0 2 nan 2 1 3 nan 3 2 3 nan 3 3 4 nan 4 4 2 nan 2 5 2 nan 2 That's not exactly what my code and data look like, but the principle is the same as in this abstract example. Any guesses, what could be the problem? Many thanks for any help in advance! EDIT: I actually have to overlay more than one column. Another example: load = [0,0,0,0,0,0,0] data = pd.DataFrame(load) for i in range(1, 10): data[i] = data[0] data overlay = pd.DataFrame([0,0,0,0,6,6,0]) overlay data.iloc[:, [1,2,4,5,7,8]] += overlay.iloc[:, 0] data WHAT??! The result is completely crazy. Columns 1 and 2 aren't changed at all. Columns 4 and 5 are changed, but in every row. Columns 7 and 8 are nans. What am I missing? That is what I would expect the result to look like:
Read in browser »  By mad_mouse on Jun 05, 2021 01:03 am I want to create a dictionary with multiple values in the form of a list for value of a key(To be precise for key '0').But when I use the zip function it is only giving the last updated value for that key instead of all values attached to that key. Below is the code. values_list = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]] keys_list = [0,0,0,1,0,0,2,-1,0] my_dict = dict(zip(keys_list, values_list)) print(my_dict) Output from above code: {0: [2, 2], 1: [1, 0], 2: [2, 0], -1: [2, 1]} Required Output: {0: [[0, 0],[0, 1],[0, 2],[1, 1],[1, 2],[2, 2]], 1: [1, 0], 2: [2, 0], -1: [2, 1]} Read in browser »  By Prof Von Lemongargle on Jun 04, 2021 05:04 pm We are trying to write a powershell script that can read data from an Aurora PostgreSQL cluster. We want to do this from within the Lambda dotnetcore3.1 environment. I don't see any documentation anywhere in google space that gives any pointers on what program/cmdlet/module could be used. In Windows, we can use an ODBC driver and/or psql. However, neither of these seem to exist in the Lambda ecosystem. Has anyone successfully made a connection to PostgreSQL in Lambda using powershell? If so, what did you use to do it? Read in browser »  By AdamT on Jun 04, 2021 04:39 pm I have 2 snippets of code for Amazon's AWS S3 storage area. One allows access to certain User folders only, but does not allow the user to see the file/img details for some reason. When I add the 2nd snippet I found it allows the User to see the file/img details, but then also gives the User access to folders I don't want them to have access to. I've tried to rearrange this a million ways but cannot get them to mesh. Can anyone help with this? Here is Code Block 1: { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowUserToSeeBucketListInTheConsole", "Action": [ "s3:ListAllMyBuckets", "s3:GetBucketLocation" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::*" ] }, { "Sid": "AllowRootAndHomeListingOfCompanyBucket", "Action": [ "s3:ListBucket" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::tp-new-aframe-displays" ], "Condition": { "StringEquals": { "s3:prefix": [ "", "tp-User-1/" ], "s3:delimiter": [ "/" ] } } }, { "Sid": "AllowListingOfUserFolder", "Action": [ "s3:ListBucket" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::tp-new-aframe-displays" ], "Condition": { "StringLike": { "s3:prefix": [ "tp-User-1/${aws:username}/*" ] } } }, { "Sid": "AllowAllS3ActionsInUserFolder", "Effect": "Allow", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::tp-new-aframe-displays/tp-User-1/${aws:username}/*" ] } ] } And here is code block 2: { "Sid": "ListObjectsInBucket", "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::tp-new-aframe-displays" ] }, { "Sid": "AllObjectActions", "Effect": "Allow", "Action": "s3:*Object", "Resource": [ "arn:aws:s3:::tp-new-aframe-displays/tp-User-1/${aws:username}/*" ] } Any help is greatly appreciated. I'm not an expert programmer, but I'm good enough to be "dangerous". Read in browser »  By Kyle Jamieson on Jun 04, 2021 03:43 pm We are developing an nopCommerce based application. Our login page needs to be minimalistic and would need only an email id, password entry fields and a Login button. Could you point me to best practices for achieving the above objective ? Do I modify the corresponding pages found in \Presentation\Nop.Web\Views\Customer\ & controllers in \Presentation\Nop.Web\Controllers\ Or Is there a better way of doing this and organizing all the modified files in one place/folder so that upgrading to future versions of nopCommerce will not be difficult ? The requirement is to ensure that all the changes made to the project(views/controllers etc) are in one folder so that they are not overwritten when we upgrade to a newer version of nopCommerce. I read somewhere that you can copy stuff you need to change (Login.chtml, CustomerController) to Themes/DefaultClean and then make your changes in this folder. I dont remember where i read it. I feel doing so will make it that much easier to maintain our codebase because all your custom code is in one place/folder/sub folders Is this a best practise? And is there a disadvantage to this method of doing things? Read in browser »  By mattsmith5 on Jun 04, 2021 01:58 pm I am reading about Message Handlers below, and trying to understand the difference between Message Handlers and regular Application services. Can anyone provide a good explanation? They look the same, reviewing at the text and diagrams below. https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/http-message-handlers
Read in browser »  By agent00i on Jun 04, 2021 01:21 pm Is it possible to get access to the rtdb requests in the service worker using Firebase JavaScript SDK? I'm currently using firebase.database.ref('activities/${uid}').on('value', snapshot => {...}); to retrieve the activities of a user from firebase. Now in my service-worker I want to access the request using Workbox registerRoute( <firebase activities url>, <CachingStrategy> ) in order to cache the activities of a user for offline availability. Thanks in advance! Read in browser »  By m. vokhm on Jun 04, 2021 11:44 am I've written a Java class for 128-bit floating-point arithmetic. Among other methods, it has a method intended to generate a pseudo-random value in the range [0, 1.0). Although I use the standard java.util.Random class that I consider reliable enough, the way I construct the value of my Quadruple class from it, may occur erroneous. So I'd like to make sure that the random values it returns are random enough. I've checked the distribution of the magnitudes over 10_000 subranges with the Chi-Square criteria, and checked the frequencies of 1 in each bit position of the mantissa, and I've looked at the hexadecimal representations of the numbers with the naked eye, that's all I could think of. So far everything looks quite well. But these tests don't check many other possible flaws of the pseudo-random numbers (say, a potentially possible correlations between the bits of the mantissa or simply repetition of a short sequence of values). Are there any ways to test a sequence of such numbers more carefully and comprehensively? In case it's relevant to the question, the value of a number of this type is internally stored as 128 bits (two longs) of the mantissa and 32 bits of the exponent. Read in browser »  By David Klempfner on Jun 04, 2021 06:23 am I was reading this question about Lists and deferred execution. SLaks mentioned you can replace the ToList() in this code with a Join() instead and it'd be much faster. How can I change this code to use IEnumerable.Join()? var dic = new Dictionary<int, string>(); for (int i = 0; i < 20000; i++) { dic.Add(i, i.ToString()); } var list = dic.Where(f => f.Value.StartsWith("1")).Select(f => f.Key).ToList(); var list2 = dic.Where(f => list.Contains(f.Key)).ToList();
Read in browser »  Recent Articles:
|
No comments:
Post a Comment