Get a byte array no encode/decode in base64 from REST Service - It's possible? Posted: 28 May 2022 09:51 PM PDT I was speculating how to receive a clean byte array from a wap-api (no encode/decode in base64). I still don't know if this is possible. Possibly there are things that I am doing wrong, or that I don't know yet. I have created a simple example to explain the issue. As you can see I'm just trying to send a text string encoded in a byte array, and decode it on the client side. Backend, a minimal API using System.Net; using System.Net.Http.Headers; using System.Text; var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); app.MapGet("/GetQuote", () => HttpBinaryDataTest.GetQuote()); app.Run(); class HttpBinaryDataTest { public static HttpResponseMessage GetQuote() { var text = "I became insane, with long intervals of horrible sanity."; var bytes = Encoding.UTF8.GetBytes(text); var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(bytes) }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); return response; } } Frontend Test, a console application using System.Text; Console.WriteLine("Http Binary Test"); Console.WriteLine("Press any key to start..."); Console.ReadKey(); var h = new HttpTest(); var quote = await h.GetQuote(); Console.WriteLine(quote); Console.WriteLine("Press any key to end..."); Console.ReadKey(); h.Dispose(); // ------------------------------------------------------- class HttpTest : IDisposable { string apiRoot = "http://localhost:5274/"; // ApiTest readonly HttpClient client; public HttpTest() { client = new HttpClient { BaseAddress = new Uri(apiRoot) }; } public async Task<string> GetQuote() { var response = await client.GetAsync($"GetQuote"); var bytes = await response.Content.ReadAsByteArrayAsync(); var decodedText = Encoding.UTF8.GetString(bytes); // Should be: // I became insane, with long intervals of horrible sanity. return decodedText; } public void Dispose() => client?.Dispose(); } When I run the client, what I get is a JSON, without errors, but I don't know how to get the data I expect. What am I missing? What am I doing wrong? The response: { "version": "1.1", "content": { "headers": [{ "key": "Content-Type", "value": ["application/octet-stream"] } ] }, "statusCode": 200, "reasonPhrase": "OK", "headers": [], "trailingHeaders": [], "requestMessage": null, "isSuccessStatusCode": true } |
An error occured when I wanted to used conda shared virtual environment:CondaValueError: prefix already exists: E:\ano Posted: 28 May 2022 09:51 PM PDT I want to use the virtual environment that my friend shared with me,which named'python38_env.yml'. But when I entered the command below in the command window: conda env create -f /TuXiangKeShe/License_Plate/python38_env.ym An error occured: CondaValueError: prefix already exists: E:\ano How Can I solve it? Thank u for ur help!! |
Regular Expression parse json object of first match only Posted: 28 May 2022 09:51 PM PDT I have a lots of javascript code with different structure but inside every js code, there is multiple json with similar structure. I want to parse only those object whose has key "@context": "https://schema.org", I have written this pattern, but it is matching the joson with with some javascript code. I want to only grabe the json object, that's it.can anyone help me? (\{\s\S\@context\"\:\s\"https\:\//schema\.org\"\,[\s\S]+) Here you go for example code: ); jQuery(function ($) { $('.cst_CERTIFIED_DEALER .cstBtn').append('<img src="//pictures.dealer.com/p/pellegrinoautosalesllc/0869/88d3d9a6608ebd537372b5db5fdde7b1x.jpg" alt="" />').css({'background':'none'}); }); jQuery(function ($) { var $ddcValueStatementHeader = $('.value-statement-header [data-widget-id="template-header1"]'); if($ddcValueStatementHeader.length) { $ddcValueStatementHeader.append($(".cst_CARFAX")).find(".cstBtn").css('z-index','950'); } else { $('.header-default[data-widget-id="template-header1"]').append($(".cst_CARFAX")).find(".cstBtn").css('z-index','950'); } $(".cst_CARFAX .cstBtn").css('cursor','auto'); }); jQuery(function ($) { $('.cst_CARFAX .cstBtn').append('<img src="/sites/p/pellegrinoautosalesllc/images/carfax-logo.png" alt="CARFAX" />').css({'background':'none'}); }); jQuery(function ($) { var $ddcValueStatementHeader = $('.value-statement-header [data-widget-id="template-header1"]'); if($ddcValueStatementHeader.length) { $ddcValueStatementHeader.append($(".cst_EDMUNDS_AWARD")).find(".cstBtn").css('z-index','950'); } else { $('.header-default[data-widget-id="template-header1"]').append($(".cst_EDMUNDS_AWARD")).find(".cstBtn").css('z-index','950'); } $(".cst_EDMUNDS_AWARD .cstBtn").css('cursor','auto'); }); jQuery(function ($) { $('.cst_EDMUNDS_AWARD .cstBtn').append('<img src="//pictures.dealer.com/p/pellegrinoautosalesllc/0002/6f1c3979ac0afac9b8d12ffb90e5af73x.jpg" alt="" />').css({'background':'none'}); }); var el = document.createElement('script'); el.type = 'application/ld+json'; el.id = 'ddc-schemaorg-integration'; tpsSchemaJson = ( typeof tpsSchemaJson != 'undefined' && tpsSchemaJson instanceof Array ) ? tpsSchemaJson : []; // Car specific data var vehicleSchema = { "@context": "https://schema.org", "@type": "Car", "description": document.head.querySelector("[name=description]") ? document.head.querySelector("[name=description]").content : "", "vehicleModelDate": "2015", "manufacturer": "Ram", "model": "1500", "sku": "08c765ea0a0e0a922cefdf66496c54cd", "bodyType": "Truck Crew Cab", "itemCondition": "used", "url": location.origin + location.pathname, "vehicleIdentificationNumber": "3C6RR7LT1FG710130", "fuelEfficiency": ["16","23"], "driveWheelConfiguration":"4x4", "vehicleEngine": "V-8 cyl", "color": "Bright White", "vehicleInteriorColor": "Diesel Gray/Black", "fuelType": "Regular Unleaded", "mileageFromOdometer": "60455", "vehicleTransmission": "8 speed automatic", "name": "Ram 1500 Truck Crew Cab", "image": "https://images.dealer.com/autodata/us/large_stockphoto-color/2015/USC50RMT11CB0/PW7.jpg", "offers": { "@type": "Offer", "priceCurrency": "USD", "price": "31000.0", "availability": "http://schema.org/InStock" } }; tpsSchemaJson.push(vehicleSchema); var hours = "[09:00 to 7:00pm-${pmtime}=Tu Mo Th, 09:00 to 4:00pm-${pmtime}=Sa, 09:00 to 5:00pm-${pmtime}=Fr We]".trim().replace(/]/g," ").replace(/[\[\]\[]/g,"").replace(/\=/g, " ").replace(/, /g, ",").trim().split(","); var social = []; var social = "https://www.facebook.com/PellegrinoAuto,https://www.youtube.com/channel/UCsVaRr3q6TVBeiIfgByQo7g".replace(/"/g, "").trim().split(","); tpsSchemaJson = ( typeof tpsSchemaJson != 'undefined' && tpsSchemaJson instanceof Array ) ? tpsSchemaJson : []; var autodealer = { "@context" : "http://schema.org", "@type" : "AutoDealer", "openingHours" : hours, "name" : "Pellegrino Auto Sales", "url" : location.origin, "address": { "@type": "PostalAddress", "addressLocality": "Batavia", "addressRegion": "NY", "postalCode": "14020", "streetAddress": "4060 Pearl St Rd" }, "image": "https://pictures.dealer.com/p/pellegrinoautosalesllc/1186/6c3181b62e95f47569cab0f5772980ddx.jpg", "hasMap": "https://www.google.com/maps/place/Pellegrino+Auto+Sales/@42.9944888,-78.2148906,17z/data=!3m1!4b1!4m5!3m4!1s0x89d3edd202106ad7:0xf37ec17084302960!8m2!3d42.9944888!4d-78.2126966", "description": "Used car dealership in Batavia, NY carries a wide variety of quality and affordable pre-owned vehicles from top makers like Chevrolet, Ford, Nissan, Toyota and more. Apply online for car loans or browse inventory now!", "logo": "https://pictures.dealer.com/p/pellegrinoautosalesllc/1627/907d4e642e3374952183d6026dc0d492x.jpg", "sameAs" : social, "geo" : { "@type" : "GeoCoordinates", "latitude" : "42.994680", "longitude" : "-78.212698" }, "contactPoint": { "@type": "ContactPoint", "contactType": "Customer Service", "telephone": "+15853442658" }, "telephone": "+15853442658", "priceRange": "Call for quote", "areaServed": ["Batavia", " Le Roy", " Medina NY", " Buffalo", " Rochester", " NY"] }; tpsSchemaJson.push(autodealer); el.text = JSON.stringify(tpsSchemaJson); console.log("DDC Schema.org code loaded.") jQuery(function($) { $('body').append(el); }); $('[data-widget-id="template-header1"]').append($('.socialheader-header-container').removeClass('hidden').removeClass('hide')); window.DDC = window.DDC || {}; DDC.dataLayer = (DDC.dataLayer || {}); DDC.dataLayer.site = (DDC.dataLayer.site || {}); DDC.dataLayer.site.siteInfo = (DDC.dataLayer.site.siteInfo || {}); DDC.dataLayer.site.siteInfo.vinLensAccountId = 19634; window.DDC = window.DDC || {}; var trackerNames = []; trackerNames.push('UA1436281301'); ga('create', {trackingId: 'UA-143628130-1', cookieDomain: 'auto', name: 'UA1436281301'}); ga(function() { for (var i=0; i < trackerNames.length; ++i) { var name = trackerNames[i]; ga(name+'.send', 'pageview'); } }); if( (Math.random() * 100) < 5 ) { DDC.getScripts({ js: ['/v9/media/js/web-vitals-tracking/google-analytics/index.js'] }); } if (jQuery.cookie !== undefined && (!jQuery.cookie('ddc_abc_cache') || jQuery.cookie('ddc_abc_cache') === '[object Object]' || !jQuery.cookie('ddc_abcamm_cache'))) { $(function() { jQuery.ajax({ url: "//pixall.esm1.net/cookie", xhrFields: { withCredentials: true }, success: function (data) { var eoCookieExists = !!jQuery.cookie('ddc_abc_cache'); var adCookies = ['abc', 'abcc', 'abcamm', 'abcg']; for (var i = adCookies.length - 1; i >= 0; i--) { var cookie = adCookies[i]; if (typeof data[cookie] !== undefined) { var expirationDays = (data[cookie] === "") ? 1 : 7; jQuery.cookie('ddc_' + cookie + '_cache', data[cookie], { expires: expirationDays, path: '/' }); } } if (data['abc']) { sessionStorage.setItem("pixallCookieIsSet", true); } if (!eoCookieExists && jQuery.cookie('ddc_abc_cache')) { window.DDC = window.DDC || {}; window.DDC.tracking = window.DDC.tracking || {}; window.DDC.tracking.ddc_abc_cache = data['abc']; jQuery.publish('ddc-eo-cookies-set'); } } }); }); } window.DDC = window.DDC || {}; window.DDC.i18n = window.DDC.i18n || {}; window.DDC.i18n.labels = Object.assign(window.DDC.i18n.labels || {}, { 'NO': 'No', 'OOPS_EXCLAMATION_YOU_MISSED_THIS_ONE': 'Oops\x21\x20You\x20missed\x20this\x20one.', 'PLEASE_CORRECT_THIS_VALUE': 'Please\x20correct\x20this\x20value.', 'PLEASE_ENTER_A_NUMERIC_VALUE': 'Please\x20enter\x20a\x20numeric\x20value.', 'PLEASE_ENTER_A_VALID_EMAIL_ADDRESS': 'Please\x20enter\x20a\x20valid\x20email\x20address.', 'PLEASE_ENTER_A_VALID_URL': 'Please\x20enter\x20a\x20valid\x20URL.', 'PLEASE_ENTER_A_VALUE_LARGER_THAN_ONE_DOLLAR': 'Please\x20enter\x20a\x20value\x20larger\x20than\x20\x241.', 'PLEASE_ENTER_A_VALUE_SMALLER_THAN_ONE_DOLLAR': 'Please\x20enter\x20a\x20value\x20smaller\x20than\x20\x241.', 'YOU_HAVE_XX_INVALID_ENTRIES_IN_THE_FORM': 'You\x20have\x20XX\x20invalid\x20entries\x20in\x20the\x20form', 'TCPA_CONSENT_ERROR_VERBIAGE': 'Your\x20consent\x20is\x20required\x20to\x20complete\x20this\x20action.\x20If\x20you\x20choose\x20to\x20not\x20opt\x2Din,\x20please\x20select\x20a\x20different\x20contact\x20method.\x20', 'VIDEOPLAYER_CAPTIONS_TITLE': 'Captions', 'VIDEOPLAYER_CAPTIONS_ON': 'On', 'VIDEOPLAYER_CAPTIONS_OFF': 'Off', 'VIDEOPLAYER_FULLSCREEN': 'Fullscreen', 'VIDEOPLAYER_QUALITY_TITLE': 'Quality', 'VIDEOPLAYER_QUALITY_HIGH': 'High', 'VIDEOPLAYER_QUALITY_LOW': 'Low', 'INVALID_DATE': 'Invalid\x20date' }); }; jQuery(scripts); /*]]>*/ </script> <div data-location="page-fo |
Actor Critic algorithm for variable action spaces in each state Posted: 28 May 2022 09:50 PM PDT I am working on a problem which has different number and types of actions in each state. I want to apply actor critic algorithm to my problem since the action space and state space is vast. How can I adopt AC algorithms for varying actions in each state? |
Using Rcpp for faster extraction and summary of lm output Posted: 28 May 2022 09:48 PM PDT I'm trying to speed up extraction from R's summary lm object when contained in an extremely large loop. The following is my attempt as a Rcpp to speed it up. Toy-Data synthetic_LMsummary<-lapply(1:100000L,function(UU){summary(lm(rnorm(500)~replicate(2,{rnorm(500)})))}) R Version tidy.train <- function(s,SelectedRow=3) { out<-data.frame( estimate=s$coefficients[, "Estimate"][SelectedRow], std.error=s$coefficients[, "Std. Error"][SelectedRow], statistic=s$coefficients[, "t value"][SelectedRow], p.value=s$coefficients[, "Pr(>|t|)"][SelectedRow], rsquared=s$r.squared ) row.names(out) <- NULL out } synthetic_LMsummary %>% purrr::map_dfr(~tidy.train(.,SelectedRow=3)) Attempted Rcpp Version Rcpp::sourceCpp(code=' #include <Rcpp.h> // [[Rcpp::export]] using namespace std; using namespace Rcpp; Rcpp::NumericMatrix RcppTidy(Rcpp::List Summary_List,int mat_cols, int select) { int mat_rows = Summary_List.length(); Rcpp::NumericMatrix Output_Mat(mat_rows,mat_cols); for (int i = 0; i < Summary_List.length(); ++i) { Rcpp::List SubSet=Summary_List[i]; Rcpp::NumericMatrix CoefDF=SubSet["coefficients"]; Rcpp::NumericVector Coef=CoefDF.row(select); Rcpp::NumericVector rsquared=SubSet["adj.r.squared"]; Output_Mat(i,_) = cbind(Coef,rsquared); } return Output_Mat; } ') Tidy_synLM<-RcppTidy(synthetic_LMsummary,5L,3L) |
Saving a file in OneDrive from Azure Functions Posted: 28 May 2022 09:48 PM PDT What's the simplest way for an Azure Functions to save a file into OneDrive? How does authentication work from a deployed Azure Function? To make this discussion simpler, we have a string var content = "This is the file content" which needs to be saved as sample.txt file. What if OneDrive folder is shared with an URL (real shared OneDrive link, will be removed - https://1drv.ms/f/s!Ak7ywxppmRtB8uRKhvT1FLmNBwXNwQ) and no authentication is required? |
How to restart this Posted: 28 May 2022 09:51 PM PDT I am making number guesser program and I am trying to figure out how to restart this if you get the number wrong. I have tried while true loops and It just keeps asking the question. I need some help with this thanks (python) import random ask = input("Guess a number between 0 and 10") r1 = random.randint(0, 1) print("The number is % s" %(r1)) if int(ask) == r1: print("right") else: print("wrong") |
How to compare two lists? Posted: 28 May 2022 09:50 PM PDT tweets = [ "Wow, what a great day today!! #sunshine", "I feel sad about the things going on around us. #covid19", "I'm really excited to learn Python with @JovianML #zerotopandas", "This is a really nice song. #linkinpark", "The python programming language is useful for data science", "Why do bad things happen to me?", "Apple announces the release of the new iPhone 12. Fans are excited.", "Spent my day with family!! #happy", "Check out my blog post on common string operations in Python. #zerotopandas", "Freecodecamp has great coding tutorials. #skillup" ] happy_words = ['great', 'excited', 'happy', 'nice', 'wonderful', 'amazing', 'good', 'best'] Question : Determine the number of tweets in the dataset that can be classified as happy. MY CODE : number_of_happy_tweets = 0 for i in tweets: for x in i: if x in happy_words: number_of_happy_tweets += len(x) Why this code is not working??????? |
Search bar using Window. Find in js and html Posted: 28 May 2022 09:49 PM PDT Hello I am trying to make a search bar to search anything which is available on a html page. I used window.find method.it highlights the string if its available in the html page. It returns a boolean value true or false. It gives false if the searched string is not available. But main problem is that it also returns false if all the searched strings are highlighted.Then how can I message the user that Nothing found OR searched text is already highlighted. I also want to Search again if button clicked again also when all the searched text is highlighted . I AM USING THIS CODE BUT ITS NOT COMPLETING MY ALL WISHES THAT I WANT. JS function SEARCH(){ var Search=document.getElementById("Search").value; var result=window.find(Search); if (result == false) { alert("Nothing found or already highlighted " ); } } HTML <input class="FLDS" type="text" id="Search" placeholder="Search" /> <button onclick="SEARCH()" id="SEARCHIT">SEARCH</button> <p> A paragraph is a self-contained unit of discourse in writing dealing with a particular point or idea. A paragraph consists of one or more sentences. Though not required by the syntax of any language, paragraphs are usually an expected part of formal writing, used to organize longer prose. </p> |
Live server isn't running scripts Posted: 28 May 2022 09:52 PM PDT I'm on chrome on a Mac, and the index file runs but the script doesn't change anything. I tried just removing paragraphs and that doesn't work either. I tried hard refreshing and running from the Live extension. This is the code from Index.html <!DOCTYPE html> <html> <head> <h1> I've a lot of things to do today.</h1> </head> <body> <p> 1. Get the litter & Wet Food.</p> <p> 2. Clean the Room.</p> <p> 3. Go out with the girlfriend.</p> <p> 4. Teach Rishabh.</p> <p> 5. Watch a show.</p> <p> 6. DON'T GET ANYMORE NFTS SER.</p> <script scr="scripts.js"></script> </body> </html> and scripts.js let ps = document.querySelectorAll('p') ps.forEach(function(p){ p.remove() }) The script isn't called at all because even a simple console.log statement in the scripts.js file won't run. No errors either :/ Thanks a lot for the help. I'm super new and this has been kinda frustrating. |
How to switch between front camera and rear camera in javascript? Posted: 28 May 2022 09:50 PM PDT let constraints; function handleVideo(){ const constraints = { video: { facingMode: { exact: 'user' } } }; var video; navigator.mediaDevices.getUserMedia(constraints). then((stream) => { video = document.createElement("video") video.srcObject = stream video.play() video.onloadeddata = () => { ctx.height = video.videoHeight } }) } I know by changing exact to environment can switch between front and back camera. But I don't know how to do this onclick. |
Property 'text' does not exist on type 'Comment', but it does Posted: 28 May 2022 09:52 PM PDT {post?.comments?.map((comment) => ( <div>{comment.text}</div> ))} Post is type Post, comments is type [Comment]. Here are the type definitions from another file. Unfortunately my project is too large to post all of it, and most is irrelevant to this problem anyways. I can post anything else that is needed upon request. I would also like to note that the code does not fail when executed, only annoying IDE complaints from Typescript that 'text' does not exist on type Comment. The subreddit property on Post does not have this problem, interestingly enough. type Comment { created_at: DateTime id: ID! post_id: ID text: String username: String } type Post { body: String created_at: DateTime id: ID! image: String subreddit_id: ID title: String username: String votes: [Vote] @materializer( query: "getVotesByPostId" arguments: [{ name: "post_id", field: "id" }] ) comments: [Comment] @materializer( query: "getCommentsByPostId" arguments: [{ name: "post_id", field: "id" }] ) subreddit: [Subreddit] @materializer( query: "getSubredditListById" arguments: [{ name: "id", field: "subreddit_id" }] ) } |
How to use variable condition to filter data in Pandas Posted: 28 May 2022 09:52 PM PDT I met a problem about Pandas using. I would like to use Pandas [xx==xx] style to filter something that fit this condition. Here is my code, for c in range(1,len(concept)+1): concept_name = "C"+str(c) data_concept = data[data["concept"] == concept_name] ... # do something in this data_concept But it always gets "Empty Dataframe". When I directly set it to "C1", it gets data in which the column concept equal C1 correctly. data_concept = data[data["concept"] == "C1"] I need to run all "C1" to "C9" conditions, so I use for-loop to try to finish this. I replace this condition with different numbers in every loop, so my thought is to use the variable to replace it. But it works not as I think. Please inform me where I am wrong. Thanks for your time. |
HTML form not giving expected output every time Posted: 28 May 2022 09:51 PM PDT Description of the issue: I have made a form to send data from the front-end (JavaScript) to the back-end (PHP). The back-end is supposed to send a response back and then I can use fetch() to determine what to do from there. Now, the interesting thing is that this works... but not all of the time. Every now and then, the form decides not to send an alert message with the response message. It also - for some reason - shows the form parameters in the URL, which is not how it should happen: Unexpected output: Expected output: What have I tried? At first, I thought there might have been some duplicate code or a function somewhere that is sending the request twice but after a long and thorough search through all of the JavaScript files in the project, there is nothing that even hints towards it. I have debugged using alert(json.message) to see what the value of json.message is when the issue happens and nothing is logged to the console. I thought maybe it might have been something to do with my back-end API but after a trial of sending 20 of the same requests using Postman, every single trial did what it was supposed to do. Relevant code: var form = document.getElementById('registerForm'); form.addEventListener("submit", function(e) { if (!validateRegisterForm()) { e.preventDefault(); // Cancel form submission } else sendRegisterForm(); }); async function sendRegisterForm() { try { var formData = new FormData(form); let res = await fetch("http://localhost/backend/api/users/register", { method: 'POST', body: formData, }); var json = await res.json(); alert(json.message); if (res.status === 200) location.reload(); // If user login is successful, refresh the page } catch (error) { console.log(error); } } |
Android Studio not opening the finder in order to open any project in mac Posted: 28 May 2022 09:51 PM PDT Android Studio version: Chipmunk 2021.2.1 Mac version: macOS Monterey version 12.4 Whenever I click open in the above image in order to open any of my current projects, android studio freezes completely, then I have to force quiet it in order to try again. Im able to open all the projects which are in the recent menu list, and also able to create new projects as well. I tried to open one of the projects from the recent menu list and then tried to open other projects using the File-> open but it freeze again. Any solutions to this? |
React Select does not change Label according to defaultValue Posted: 28 May 2022 09:50 PM PDT import React from "react"; import { useState } from "react"; import Select from "react-select"; const EditMitarbeiter = () => { const optionsField1 = [ { id: "1", value: "test1", label: "Test1"}, { id: "2", value: "test2", label: "Test2"}, { id: "3", value: "test3", label: "Test3"}, { id: "4", value: "test4", label: "Test4"}, ]; const[functions, setFunctions] = useState([ {field1:"test1",field2:"test2",field3:"test3",input:"Test"} ]); const handleFunctionAdd = () => { setFunctions([...functions, {field1:"",field2:"",field3:"",input:""}]); }; const handleFunctionRemove = (event, index) => { event.preventDefault(); // verhindert Default Verhalten von Button, ist somit kein "Submit-Button" mehr und lädt Seite nicht neu console.log(index); // FEHLER: este Funktion wird nicht entfernt, sondern folgende const list = [...functions]; list.splice(index,1); setFunctions(list); }; const handleFunction1Change = (event, index) => { const newFunctions = [...functions]; newFunctions[index].field1 = event.value; setFunctions(newFunctions); } return ( <div> <div id="content"> <form id="Funktion"> <legend>Funktionen</legend> {functions.map((f,index) => ( <div key={index} id="function-box"> <div class="ReactSelect"><Select options={optionsField1} defaultValue={f.field1} onChange={(event) => handleFunction1Change(event,index)}/></div> </div> ))} </form> </div> </div> ); } export default EditMitarbeiter; I got the problem that my the label of the ReactSelect does not change and it stays blank. I already looked through some similar questions but i couldn't figure out why my example does not work even though i used the solutions of the other questions. Also a side question, is it worth to use ReactSelect over the normal HTMLSelect cuz i just get problems with the ReactSelect... |
I need to change two words to arabic words in wordpress theme Posted: 28 May 2022 09:50 PM PDT I need to change "Last updated on" and "Posted on" From the code below to another words in arabic. This code is part of the "template-tags.php" file which is part of the WordPress theme files I just tried replacing the words but it didn't work for me It just looks like this"����������" <?php if ( get_theme_mod('show_post_date', '1') == 1 ) : ?> <div class="entry-date"><i class="fa fa-clock-o"></i><span > <?php $u_time = get_the_time('U'); $u_modified_time = get_the_modified_time('U'); if ($u_modified_time >= $u_time + 60) { echo "Last updated on "; // here the_modified_time('Y-m-d'); } else {echo "Posted on "; // here the_time('Y-m-d'); } ?> |
Drop-down list of hyperlinks to other sheets in other workbooks Posted: 28 May 2022 09:51 PM PDT Through this code function onEdit(e) { if(e.source.getActiveSheet() && e.range.getRow() === 1 && e.range.getColumn() === 1) { e.source.getSheetByName(e.value).activate(); } } function sheetnames() { var out = new Array() var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets(); for (var i=0 ; i<sheets.length ; i++) out.push( [ sheets[i].getName() ] ) return out } I can switch tabs via the drop-down list. That is, if I select the name 'sheet 2' from the drop-down list, it redirects me to sheet 2 here is an example of how this code works: https://docs.google.com/spreadsheets/d/1Cf8ipDqFMJ2cIdkabGdprJGOp3kTE1EfGkKrO8OBGLY/edit#gid=0 I wanted to know if it is possible to modify this code, so that when I select a certain option in the drop-down list, it takes me to another worksheet (instead of a tab) Example In this worksheet: https://docs.google.com/spreadsheets/d/1ewhIZ37f-dVPaKW8gG7pnuzQ1CVTFGgf5uoIUH96pkA/edit?usp=sharing (first drop-down list only) If I select from the first drop-down list (Destino), for example, "Sucesso do Cliente" I want it to redirect me to this: https://docs.google.com/spreadsheets/d/1BbuJfPPOSdbvHZ5b8xVTMndeydNfslDhPLm9ftL1pLU/edit?usp=sharing What would be the best way to do this? |
Perspective Transform OMR Sheet - OpenCV Python Posted: 28 May 2022 09:52 PM PDT I am trying to make a perspective transformation with OpenCV in python. I want to align the image and find the coordinates of top left top right and bottom left and bottom right contours. here is my code so far where I can identify all the contours. gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) blur = cv2.GaussianBlur(gray,(3,3),0) edges = cv2.Canny(blur,50,100) contours, hierarchy = cv2.findContours(edges,cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) #find contours cv2.drawContours(img,contours,-1,(0,255,0),2) cv2.imshow('Contours',img) cv2.waitKey(0) Here is an image of what I get. I'd be very thankful if you could try to help me solve this problem! |
Terraform 'default_tags' behaviour for aws resources with 'default' tag value Posted: 28 May 2022 09:50 PM PDT I am facing issue while using 'default_tags' for all AWS resources deployed using Terraform. We have multiple reusable modules in a project. Now, I wanted to assign few tags to all AWS resources, I am using 'default_tags' for it and while TF apply it gives 'dependency cycle' issue. In some of tags there are "default={}" are set [working on existing TF project]. I wanted to understand that is there any impact of "default_tags" on declared tags per resource level? Please refer below code, //outputs.tf resource "null_resource" "dependencies" { depends_on = [ aws_security_group_rule.cluster_k8s_ingress ] } //main.tf module "eks" { source = "terraform-aws-modules/eks/aws" version = "18.7.2" cluster_additional_security_group_ids = [aws_security_group.additional_eks_sg.id] vpc_security_group_ids = [aws_security_group.additional_eks_worker_sg.id] } //sg.tf resource "aws_security_group_rule" "cluster_k8s_ingress" { cidr_blocks = data.aws_subnet.private.*.cidr_block description = "Allows ingress traffic from private subnets to Node Ports" from_port = local.start_port to_port = local.end_port protocol = "tcp" security_group_id = module.eks.cluster_primary_security_group_id type = "ingress" } Error output is as follows: |
Creating and plotting confidence intervals Posted: 28 May 2022 09:50 PM PDT I have fitted a gaussian GLM model to my data, i now wish to create 95% CIs and fit them to my data. Im having a couple of issues with this when plotting as i cant get them to capture my data, they just seem to plot the same line as the model without captuing the data points. Also Im also unsure that I've created my CIs the correct way here for the mean. I entered my data and code below if anyone knows how to fix this data used aids cases quarter date 1 2 1 83.00 2 6 2 83.25 3 10 3 83.50 4 8 4 83.75 5 12 1 84.00 6 9 2 84.25 7 28 3 84.50 8 28 4 84.75 9 36 1 85.00 10 32 2 85.25 11 46 3 85.50 12 47 4 85.75 13 50 1 86.00 14 61 2 86.25 15 99 3 86.50 16 95 4 86.75 17 150 1 87.00 18 143 2 87.25 19 197 3 87.50 20 159 4 87.75 21 204 1 88.00 22 168 2 88.25 23 196 3 88.50 24 194 4 88.75 25 210 1 89.00 26 180 2 89.25 27 277 3 89.50 28 181 4 89.75 29 327 1 90.00 30 276 2 90.25 31 365 3 90.50 32 300 4 90.75 33 356 1 91.00 34 304 2 91.25 35 307 3 91.50 36 386 4 91.75 37 331 1 92.00 38 368 2 92.25 39 416 3 92.50 40 374 4 92.75 41 412 1 93.00 42 358 2 93.25 43 416 3 93.50 44 414 4 93.75 45 496 1 94.00 my code used to create the model and intervals before plotting #creating the model model3 = glm(cases ~ date, data = aids, family = poisson(link='log')) #now to add approx. 95% confidence envelope around this line #predict again but at the linear predictor level along with standard errors my_preds <- predict(model3, newdata=data.frame(aids), se.fit=T, type="link") #calculate CI limit since linear predictor is approx. Gaussian upper <- my_preds$fit+1.96*my_preds$se.fit #this might be logit not log lower <- my_preds$fit-1.96*my_preds$se.fit #transform the CI limit to get one at the level of the mean upper <- exp(upper)/(1+exp(upper)) lower <- exp(lower)/(1+exp(lower)) #plotting data plot(aids$date, aids$cases, xlab = 'Date', ylab = 'Cases', pch = 20) #adding CI lines plot(aids$date, exp(my_preds$fit), type = "link", xlab = 'Date', ylab = 'Cases') #add title lines(aids$date,exp(my_preds$fit+1.96*my_preds$se.fit),lwd=2,lty=2) lines(aids$date,exp(my_preds$fit-1.96*my_preds$se.fit),lwd=2,lty=2) outcome i currently get with no data points, the model is correct here but the CI isnt as i have no data points, so the CIs are made incorrectly i think somewhere |
.Net 6 - Passing a radio button selected table row to a controller Posted: 28 May 2022 09:51 PM PDT I really feel like this should be easy but I'm thinking it may have changed with .Net 6. I can pass values to my controller with the input "name='name'" but for some reason I cannot get any values from my model into my controller. I am trying to POST my row values to the controller. I am using an enumerable. I'm not sure if I should be using a or not. Another thing is how should I be populating my table row from a loop of the model. I thought using @Html. Was for older .net and tag helpers are the new way but I couldn't get any to work populating my rows. <form method="post"> <div id="tblPullParts" class="container justify-content-center mt-3"> <table class="table table-striped"> <thead> <tr> <th></th> <th >Order #</th> <th >Item</th> <th >Description</th> <th >Quantity</th> </tr> </thead> <tbody> @foreach (var p in Model) { <tr> <td><input type="radio" id="radio" name="radio" value="@Html.DisplayFor(item => p.PartID)" /></td> @*<td><input asp-for="Selected" type="radio" value="Selected" /></td>*@ <th scope="row">@Html.DisplayFor(item => p.PartID)</th> <td>@Html.DisplayFor(item => p.Name)</td> <td>@Html.DisplayFor(item => p.ItemLocation)</td> <td>@Html.DisplayFor(item => p.PartGroup)</td> <td>@Html.DisplayFor(item => p.Description)</td> <td> <input type="text" asp-for="@p.Name" id="txtNameN" /> </td> </tr> } </tbody> </table> @*<input type="text" id="@Model[0].Name" />*@ <input type="text" id="txtName" name="txtName" value="" /> </div> <div class="text-center"> <button type="submit" class="btn btn-lg btn-success mt-3">Start Pick</button> </div> </form> [HttpPost] public async Task<IActionResult> Index( PartVM model, string radio, string txtName) { if (model?.PartID != 0) { return View("UpdatePickQuantity", model); } if (!String.IsNullOrWhiteSpace(txtName)) { } //Request.QueryString["radio"]; var lstParts = await _ordersService.GetAllParts(); return View(lstParts); } |
Access-Control-Request-Private-Network header issues Posted: 28 May 2022 09:50 PM PDT Today we updated the last version of google chrome browser (Version 102.0.5005.61). We have an aplication that runs into a vpn. And since then we start getting this errors on the console: As you can see we get a timed out error on the preflight and then the xhr request fails. We noticed that on this version of chorme they add the new header: Access-Control-Request-Private-Network. An that is what I see on the preflight headers: Serching on what could be wrong, since this is happening only when we update the chrome version and in other browsers the site works perfectly; Ive found this: https://developer.chrome.com/blog/private-network-access-preflight/ On the article is explained what to do and how to handle this. And show kind of what is happening to me: If your request would have triggered a regular CORS preflight without Private Network Access rules, then two preflights may appear in the network panel, with the first one always appearing to have failed. This is a known bug, and you can safely ignore it. Based on that I added the new header support on my API that is made on JAVA with spring boot. response.setHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS"); response.setHeader("Access-Control-Allow-Headers", "content-type"); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Max-Age", "180"); response.setHeader("Access-Control-Allow-Private-Network", "true"); response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); As you can see just added the header and return 200 for the option request if ("OPTIONS".equals(request.getMethod())) { response.setStatus(HttpServletResponse.SC_OK); return; } The site is running, meaning it get served and is loaded on chrome browser but all the API calls from the site get that error. (See screen shoots avobe). But still after that have the same issues. Any one had the same issue and was able to solve? Any help will be appreciated! Thanks! EDIT: We just add the headers on the preflight response: Access-Control-Request-Private-Network: true Access-Control-Allow-Private-Network: true Then we go to the google flags configuration and disable this: Now Im not sure why google thinks that my requests are insecure. |
Flutter two finger gestures Posted: 28 May 2022 09:52 PM PDT I'm working on a launcher app with gestures settings and I'm looking for a way to achieve two-finger swipe up and down gestures, i found out that it can be achieved by using RawGestureDetector and MultiDragGestureRecognizer , but I have no idea how to do it, can anyone share a code example or explain how to do it i tried this code sample but it doesn't seem to work : import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; class TwoFingerPointerWidget extends StatelessWidget { final Widget child; final OnUpdate onUpdate; TwoFingerPointerWidget({required this.child, required this.onUpdate}); @override Widget build(BuildContext context) { return RawGestureDetector( gestures: <Type, GestureRecognizerFactory>{ CustomVerticalMultiDragGestureRecognizer: GestureRecognizerFactoryWithHandlers< CustomVerticalMultiDragGestureRecognizer>( () => CustomVerticalMultiDragGestureRecognizer(debugOwner: null), (CustomVerticalMultiDragGestureRecognizer instance) { instance.onStart = (Offset position) { return CustomDrag(events: instance.events, onUpdate: onUpdate); }; }, ), }, child: child, ); } } typedef OnUpdate(DragUpdateDetails details); class CustomDrag extends Drag { final List<PointerDownEvent> events; final OnUpdate onUpdate; CustomDrag({required this.events, required this.onUpdate}); @override void update(DragUpdateDetails details) { super.update(details); final delta = details.delta; if (delta.dy.abs() > 0 && events.length == 2) { onUpdate.call(DragUpdateDetails( sourceTimeStamp: details.sourceTimeStamp, delta: Offset(0, delta.dy), primaryDelta: details.primaryDelta, globalPosition: details.globalPosition, localPosition: details.localPosition, )); } } @override void end(DragEndDetails details) { super.end(details); } } class CustomVerticalMultiDragGestureRecognizer extends MultiDragGestureRecognizer { final List<PointerDownEvent> events = []; CustomVerticalMultiDragGestureRecognizer({required Object? debugOwner}) : super(debugOwner: debugOwner); @override createNewPointerState(PointerDownEvent event) { events.add(event); return _CustomVerticalPointerState(event.position, onDisposeState: () { events.remove(event); }); } @override String get debugDescription => 'custom vertical multidrag'; } typedef OnDisposeState(); class _CustomVerticalPointerState extends MultiDragPointerState { final OnDisposeState onDisposeState; _CustomVerticalPointerState(Offset initialPosition, {required this.onDisposeState}) : super(initialPosition, PointerDeviceKind.touch, null); @override void checkForResolutionAfterMove() { if (pendingDelta!.dy.abs() > kTouchSlop) { resolve(GestureDisposition.accepted); } } @override void accepted(GestureMultiDragStartCallback starter) { starter(initialPosition); } @override void dispose() { onDisposeState.call(); super.dispose(); } } |
What is the use case of atomFamily in recoil? Posted: 28 May 2022 09:51 PM PDT I did my first experiment with recoil, building an editable table. Each cell has an atom which stores its row, column, and text value. The way I built this was by - initializing each cell's atom into a dictionary (just a plain object), with keys in a format of [column]x[row]
- I then iterate over these keys in the Table component, and pass only the key to each Cell component
- The Cell component uses
useRecoilState and find its specific Atom by accessing the main dictionary using the key it got passed as a prop. Now, it seems to me that this use case (creating thousands of related atoms with the same shape) is what atomFamily is meant to make easier, but I don't understand how to use it in this way, where you initialize each atom with a specific value. And, besides that, I don't understand what is the advantage of using atomFamily over storing a collection of atoms. I understand there is memoization involved, but I don't understand what is getting memoized other than, if I am reading correctly, the ability to recall a specific atom by calling the function again with the same id, which would get you pretty much the same behavior I'm getting with a dictionary. |
Failed prop type: Invalid prop `count` of type `string` supplied to `ForwardRef(TablePagination)`, expected `number` Posted: 28 May 2022 09:48 PM PDT I am getting error in my react App. I am using Material UI . I get this error when I visit this page. As per the error I am getting error in TablePagination, but I am not even using TablePagination component. I am using Data Grid component of Material UI version 4. It has server-side pagination enabled and I am passsing in the number of rows as row count.(Below is the code.) MiList component is using Data Grid. import React, { useState, useEffect, useRef, memo } from "react"; import { MiButton, MiLink, MiList } from "../../../components/Standard/MiView"; import CreateNewPropertyModal from "./CreateNewPropertyModal"; import { THEME } from "../../../components/Standard/theme"; import { Chip } from "@miview/components"; import "./StyleTable.css"; import { debounce } from "../../../utils"; import { homeSearchHook } from "./utils"; import { formatDate } from "../../../helpers/dateTools"; import { systemTypeService, stageTypeService, propertyService, } from "@miview/api"; import { SYSTEM_TYPE_CATEGORIES } from "@miview/constants"; import { useComponentState } from "@miview/hooks"; import { MiTHEME } from "@miview/theme"; import { makeStyles } from "@material-ui/core/styles"; const useStyles = makeStyles(() => ({ tableStyles: { border: 0, "& .MuiDataGrid-columnHeaderTitleContainer": { padding: 0, }, "& .MuiDataGrid-columnSeparator": { visibility: "hidden", }, }, })); const Properties = memo((props) => { const [newPropertyInProgress, setNewPropertyInProgress] = useState(); const [newOutlineInProgress, setNewOutlineInProgess] = useState(); const [stageTypes, setStageTypes] = useState([]); const [garageSwingTypes, setGarageSwingTypes] = useState([]); const [changed, setChanged] = useState(false); const [sorted, setSorted] = useState([]); const [addressInfo, setAddressInfo] = useState(null); const [properties, setproperties] = useState([]); const [pageNo, setpageNo] = useState(0); const [pageSize, setpageSize] = useState(50); const [rowCount, setrowCount] = useState(0); const [searchTerm, setsearchTerm] = useState(""); // const [setupStatuses, setSetupStatuses] = useState([]); const [homesMessage, getHomes] = homeSearchHook(); const [hasUserSearched, setHasUserSearched] = useState(false); const debouncedSearchTerm = debounce(searchTerm, 300); const isFirstRun = useRef(true); const classes = useStyles(); const getColor = (val) => { switch (val) { case "Stage Complete": return MiTHEME.colors.green.light; case "Scheduled": return MiTHEME.colors.blue.light; case "Not Scheduled": return MiTHEME.colors.bluegrey.light; case "Not Ready": return MiTHEME.colors.bluegrey.light; default: return MiTHEME.colors.blue.light; } }; const getTextColor = (val) => { switch (val) { case "Stage Complete": return MiTHEME.colors.green.primary; case "Scheduled": return MiTHEME.colors.blue.primary; case "Not Scheduled": return MiTHEME.colors.bluegrey.primary; case "Not Ready": return MiTHEME.colors.bluegrey.primary; default: return MiTHEME.colors.blue.primary; } }; const stateManager = useComponentState(); useEffect(() => { handleSearchHomes(); isFirstRun.current = false; }, [debouncedSearchTerm]); const handleSearchHomes = () => { setHasUserSearched(!isFirstRun.current); setpageNo(0); filterData({ page: 0, searchTerm: debouncedSearchTerm, }); }; useEffect(() => { // getSetupStatuses(); getStageTypes(); getGarageSwingTypes(); }, []); // const getSetupStatuses = async () => { // stateManager.run(async () => { // const response = await propertyService.getSetupStatuses(); // setSetupStatuses(response); // }); // }; const getStageTypes = async () => { stateManager.run(async () => { stageTypeService.getAll({}).then((response) => { setStageTypes(response.filter((r) => r.stageOrder !== -1)); }); }); }; const getGarageSwingTypes = async () => { stateManager.run(async () => { const response = await systemTypeService.getSystemTypesByName({ name: SYSTEM_TYPE_CATEGORIES.GARAGE_SWING, }); const mapped = response.map((i, k) => { return { value: i.systemTypeId, key: k, text: i.mainValue }; }); setGarageSwingTypes(mapped); }); }; useEffect(() => { if (!changed && stageTypes.length > 0) { let stageTypesToChange = stageTypes; stageTypesToChange.push({ stageTypeName: "No Stage" }); setStageTypes(stageTypesToChange); setChanged(true); } }, [stageTypes]); // const getPropertySetupStatusFromCustomFields = (customFieldsJson) => { // if (!customFieldsJson) return false; // const fields = JSON.parse(customFieldsJson); // const propertySetupStatuses = fields.find( // (f) => f.name === "PropertySetupStatus" // )?.value; // const statusReducer = (a, s) => // a && // propertySetupStatuses.filter((ps) => ps.id == s.statusId && ps.value) // .length > 0; // return setupStatuses.reduce(statusReducer, true); // }; const filterData = (params = {}) => { stateManager.run(async () => { getHomes( params.page !== undefined ? params.page : pageNo, params.pageSize || pageSize, params.sorted || sorted, params.searchTerm || searchTerm, isFirstRun.current, setpageNo, setpageSize, setrowCount, setproperties ); }); }; const toggleModal = () => { setNewPropertyInProgress(!newPropertyInProgress); }; const headerContent = ( <MiButton title="Home" icon="add" inverse={true} onClick={toggleModal} color={THEME.GREEN_PRIMARY} /> ); const renderHeader = ({ colDef }) => { return ( <div style={{ color: MiTHEME.colors.blue.primary, fontWeight: MiTHEME.fontWeight.bold, }} > {colDef.headerName} </div> ); }; const columns = [ { field: "addressLine1", headerName: "Address", width: 150, renderHeader: renderHeader, headerAlign: "left", align: "left", flex: 1, renderCell: (p) => { return ( <MiLink to={"/homes/" + p.propertyId} title={p.value} style={{ marginLeft: -8 }} /> ); }, }, { field: "cityName", headerName: "City", width: 150, renderHeader: renderHeader, headerAlign: "left", align: "left", flex: 0.7, }, { field: "state", headerName: "State", width: 150, renderHeader: renderHeader, headerAlign: "left", align: "left", flex: 0.6, }, { field: "community", headerName: "Community", width: 150, renderHeader: renderHeader, headerAlign: "left", align: "left", flex: 1, }, { field: "builder", headerName: "Builder", width: 150, renderHeader: renderHeader, headerAlign: "left", align: "left", flex: 1, }, { field: "currentStage", headerName: "Stage", width: 150, renderHeader: renderHeader, headerAlign: "left", align: "left", flex: 0.8, renderCell: (p) => { return ( <MiLink to={"/stages/" + p.currentStageId} title={p.value} style={{ marginLeft: -8 }} /> ); }, }, { field: "currentStageScheduledDate", headerName: "Schedule Date", width: 150, renderHeader: renderHeader, headerAlign: "left", align: "left", flex: 1, valueFormatter: (params) => { return formatDate(params.value); }, }, { field: "propertyStatus", headerName: "Status", width: 150, renderHeader: renderHeader, headerAlign: "left", align: "left", flex: 1, renderCell: ({ value }) => { return ( <Chip text={value} style={{ display: "flex", borderRadius: "30px", height: "30px", minWidth: "80px", justifyContent: "center", padding:'0 7px 0 7px' }} color={getColor(value)} textColor={getTextColor(value)} /> ); }, }, ]; const toggleOutliner = () => { setNewOutlineInProgess(!newOutlineInProgress); }; useEffect(() => { if (addressInfo) { toggleOutliner(); } }, [addressInfo]); const modals = [ newPropertyInProgress ? ( <CreateNewPropertyModal key={0} getAddressInfo={setAddressInfo} toggle={toggleModal} stageTypes={stageTypes} garageSwingTypes={garageSwingTypes} history={props.history} ></CreateNewPropertyModal> ) : ( "" ), ]; return ( <> {stateManager.statusTag("propertyListStatus")} <MiList data={properties} headerTitle={`Homes - ${hasUserSearched ? "All" : "Recent"}`} headerIcon={"home"} className={classes.tableStyles} getRowId={(row) => row.propertyId} headerContent={headerContent} modals={modals} callouts={null} columns={columns} manual defaultPageSize={50} pages={rowCount} fetchData={isFirstRun.current ? () => null : filterData} setSearch={setsearchTerm} disableSearchButton searchMessage={homesMessage} disableColumnMenu hideFilters mui /> </> ); }); export default Properties; |
VS Code editor color customisation for Python imported module names Posted: 28 May 2022 09:51 PM PDT I have been trying to change the text foreground colour of imported modules in Python files without any success. I am using Monokai Dimmed color theme in VS Code. Everything is ok, except for the Red foreground color of imported modules. In the example below, can I change the text color of 'json', 'pandas' and 'pd' ? Currently, they all appear in red, which hurst my eyes! import json import pandas as pd I tried configuring settings.json: "editor.tokenColorCustomizations" : { "types": "#17851d", "[Monokai Dimmed]": { "textMateRules": [ { "scope": "????", // I tried several scope, but none worked. "settings": { "foreground": "#FFFF00" // Trying to change to yellow color } } ] } } Many thanks |
Firefox does not print table borders on pages 2 and onwards Posted: 28 May 2022 09:51 PM PDT Problem: When printing a table on Mozilla Firefox (version 55.0.3 32bit), table borders show on the first page only, but not on any of the subsequent pages. So, i.e. printing pages 2 only does not print table borders, but printing page 1 only prints table borders. This question did not help: https://webmasters.stackexchange.com/questions/2578/how-to-prevent-table-borders-from-disappearing-while-printing (borders are still not printing on page 2 and onwards, after inserting accepted answer's CSS into my page) This is what I have: <table class="listdb">...</table> table.listdb { font-size: 10pt; border-width: 0px 0px 0px 0px; border-spacing: 0px; border-style: none; border-color: #000000; border-collapse: collapse; background-color: #FFFFFF; } table.listdb th { font-size: 10pt; border-width: 1px; padding: 1px 5px 1px 5px; border-style: solid; border-color: #000000; background-color: #7A99DD; color: #000000; vertical-align: top; } table.listdb td { font-size: 10pt; border-width: 1px; padding: 1px 5px 1px 5px; border-style: solid; border-color: #999999; border-color: #000000; vertical-align: top; } I also tried using HTML5 Boilerplate 's CSS below - didn't help (showing relevant excerpt here, when I used entire @media print block) @media print { /* * Printing Tables: * http://css-discuss.incutio.com/wiki/Printing_Tables */ thead { display: table-header-group; } tr, img { page-break-inside: avoid; } } |
Database does not exist. Make sure that the name is entered correctly Posted: 28 May 2022 09:51 PM PDT Why am I having this error? If you looked at the screenshot, you will see the database. It only happens when I am connected to two database engines. It only detects the databases from database engine below not the one highlighted. Is there a way to use my database other than closing the application and opening just one database engine? |
Optimal number of threads per core Posted: 28 May 2022 09:52 PM PDT Let's say I have a 4-core CPU, and I want to run some process in the minimum amount of time. The process is ideally parallelizable, so I can run chunks of it on an infinite number of threads and each thread takes the same amount of time. Since I have 4 cores, I don't expect any speedup by running more threads than cores, since a single core is only capable of running a single thread at a given moment. I don't know much about hardware, so this is only a guess. Is there a benefit to running a parallelizable process on more threads than cores? In other words, will my process finish faster, slower, or in about the same amount of time if I run it using 4000 threads rather than 4 threads? |
No comments:
Post a Comment