instruction
stringlengths
0
30k
I'm working on a small project where I take content from an Excel Spreadsheet and put it into a word document. I can get the two applications to communicate and put the text in the correct spot, but I cannot change the formatting and I've tried multiple ways. I think I don't understand the Range object, but I'm really not sure. Below is the code. Essentially what I want it the label ("Severity") to be bolded, and then the content, which is coming from the spreadsheet to NOT be bold. Like this: Severity: Moderate I can get it to bold the entire thing or not, but I can't get the code to bold just the label. Appreciate any help someone can provide. Many thanks. Here's the code I have so far: Sub TestBoldToWordDocument() Dim wdApp As Object Dim wdDoc As Object Dim ExcelRange As Range Dim WordRange As Object Dim TextToPaste As String Dim tblNew As Table Dim intX As Integer Dim intY As Integer Sheets("CleanSheet").Activate ' Create a new Word application Set wdApp = CreateObject("Word.Application") wdApp.Visible = True ' Set to True if you want Word to be visible ' Create a new Word document Set wdDoc = wdApp.Documents.Add Set WordRange = wdDoc.Content With WordRange .InsertAfter "Severity: " .Font.Bold = True End With With WordRange .InsertAfter Sheets("CleanSheet").Cells(2, 2).Value & vbCr .Font.Bold = False End With End Sub
How to use VBA to bold just some text
|excel|vba|ms-word|
null
Move `TimeUnit.MINUTES.sleep(2);` inside the `try` block: public void sendMessage() throws InterruptedException { String topic = "wikimedia_recent"; BackgroundEventHandler backgroundEventHandler = new WikimediaChangesHandler(kafkaTemplate, topic); String url = "https://stream.wikimedia.org/v2/stream/recentchange"; BackgroundEventSource.Builder builder = new BackgroundEventSource.Builder(backgroundEventHandler, new EventSource.Builder(URI.create(url))); try (BackgroundEventSource source = builder.build()) { source.start(); System.out.println("source started"); TimeUnit.MINUTES.sleep(2); } }
I made a zustandStore and i put the initial value at there. And at other component i set zustand to the other value. And go to other page and come again, if i console the zustand value, then the first value come firstly. So when I props or use the zustand, the outcome is different with my thought. the main code <parent component> ``` const { zustandMonitorUsage, setZustandMonitorUsage, } = useFirstSurveyStore(); const handleClick = (index: number) => { // eslint-disable-next-line no-console const answer: 1 | 2 | 4 | 8 | 16 = content[index][2]; setZustandMonitorUsage(answer); isFocus = answer; }; console.log('focus: ', isFocus, 'zus: ', zustandMonitorUsage); return ( <div className={styles.container}> <SurveyBox content={content} boxClick={handleClick} design={'fiveStyles'} isFocus={isFocus} /> </div> ); ``` <Child component> ``` import {useState} from 'react'; const SurveyBox = ({ content, boxClick, design, isFocus, }: { content: (JSX.Element | string | number | boolean)[][]; boxClick: (index: number) => void; design: string; isFocus: string | number | boolean; }) => { const [value, setValue] = useState<JSX.Element | string | number | boolean>( isFocus, ); const handleBoxClick = (index: number) => { boxClick(index); setValue(content[index][2]); }; return ( <div className={dContainer}> {content.map((item, index) => ( <div key={index}> <button className={item[2] === value ? dFocusBox : dBox} onClick={() => handleBoxClick(index)} > </button> </div> ))} </div> ); ``` <zustand> ``` interface IFirstSurveyStore { zustandMonitorUsage: -1 | 1 | 2 | 4 | 8 | 16; setZustandMonitorUsage: (newUsage: -1 | 1 | 2 | 4 | 8 | 16) => void; } const useFirstSurveyStore = create<IFirstSurveyStore>()( persist( set => ({ zustandMonitorUsage: -1, setZustandMonitorUsage: (newUsage: -1 | 1 | 2 | 4 | 8 | 16) => set({zustandMonitorUsage: newUsage}), }), {name: 'FirstSurvey'}, ), ); ``` this is my all code <parent component> ``` 'use client'; import {useState} from 'react'; import Question from '@/components/Survey/Question'; import SurveyBox from '@/components/Survey/SurveyBox'; import useFirstSurveyStore from '@/stores/firstSurvey'; import styles from '@/components/Survey/index.module.scss'; /** * 내용, 클릭 체크 함수, 선택지 중복 개수 넣기 */ const Form = () => { const [isClicked, setIsClicked] = useState<boolean>(false); const { zustandMonitorUsage, setZustandMonitorUsage, setZustandMouseUsage, setZustandKeyboardUsage, } = useFirstSurveyStore(); const questionContent = '어떤 용도로 사용하실 건가요?'; const presentPage: string = '1'; const content: [string, string, 1 | 2 | 4 | 8 | 16][] = [ ['사무', '', 1], ['게임', '', 2], ['개발', '', 4], ['영상', '', 8], ['취미', '', 16], ]; let isFocus: string | number | boolean = zustandMonitorUsage; const handleClick = (index: number) => { // eslint-disable-next-line no-console const answer: 1 | 2 | 4 | 8 | 16 = content[index][2]; setZustandKeyboardUsage(answer); setZustandMonitorUsage(answer); setZustandMouseUsage(answer); setIsClicked(true); isFocus = answer; }; console.log('focus: ', isFocus, 'zus: ', zustandMonitorUsage); return ( <div className={styles.container}> <Question questionContent={questionContent} /> <SurveyBox content={content} boxClick={handleClick} design={'fiveStyles'} isFocus={isFocus} /> </div> ); }; export default Form; ``` <Child component-surveyBox> ``` /* eslint-disable @next/next/no-img-element */ import {useState} from 'react'; import twoStyles from '@/components/Survey/SurveyBoxTwo.module.scss'; import threeStyles from '@/components/Survey/SurveyBoxThree.module.scss'; import fourStyles from '@/components/Survey/SurveyBoxFour.module.scss'; import fiveStyles from '@/components/Survey/SurveyBoxFive.module.scss'; const SurveyBox = ({ content, boxClick, design, isFocus, }: { content: (JSX.Element | string | number | boolean)[][]; boxClick: (index: number) => void; design: string; isFocus: string | number | boolean; }) => { const [value, setValue] = useState<JSX.Element | string | number | boolean>( isFocus, ); let dContainer: string | undefined; let dBox: string | undefined; let dFocusBox: string | undefined; let dPositionContainer: string | undefined; let dContent: string | undefined; if (design === 'twoStyles') { dContainer = twoStyles.container; dBox = twoStyles.box; dFocusBox = twoStyles.focusBox; dPositionContainer = twoStyles.positionContainer; dContent = twoStyles.content; } else if (design === 'threeStyles') { dContainer = threeStyles.container; dBox = threeStyles.box; dFocusBox = threeStyles.focusBox; dPositionContainer = threeStyles.positionContainer; dContent = threeStyles.content; } else if (design === 'fourStyles') { dContainer = fourStyles.container; dBox = fourStyles.box; dFocusBox = fourStyles.focusBox; dPositionContainer = fourStyles.positionContainer; dContent = fourStyles.content; } else { dContainer = fiveStyles.container; dBox = fiveStyles.box; dFocusBox = fiveStyles.focusBox; dPositionContainer = fiveStyles.positionContainer; dContent = fiveStyles.content; } const handleBoxClick = (index: number) => { boxClick(index); setValue(content[index][2]); }; return ( <div className={dContainer}> {content.map((item, index) => ( <div key={index}> <button className={item[2] === value ? dFocusBox : dBox} onClick={() => handleBoxClick(index)} > <div className={dPositionContainer}> <div className={dContent}>{item[0]}</div> {item[1] !== '' && typeof item[1] === 'string' && typeof item[0] === 'string' && ( <div> <img src={item[1]} alt={item[0]}></img> </div> )} </div> </button> </div> ))} </div> ); }; export default SurveyBox; ``` <Zustand - store> ``` import {create} from 'zustand'; import {persist} from 'zustand/middleware'; // 용도, 가격, 색 interface IFirstSurveyStore { zustandMonitorUsage: -1 | 1 | 2 | 4 | 8 | 16; setZustandMonitorUsage: (newUsage: -1 | 1 | 2 | 4 | 8 | 16) => void; zustandKeyboardUsage: -1 | 1 | 2 | 4 | 8 | 16; setZustandKeyboardUsage: (newUsage: -1 | 1 | 2 | 4 | 8 | 16) => void; zustandMouseUsage: -1 | 1 | 2 | 4 | 8 | 16; setZustandMouseUsage: (newUsage: -1 | 1 | 2 | 4 | 8 | 16) => void; zustandTotalPrice: number; setZustandTotalPrice: (newPrice: number) => void; zustandColor: 'INIT' | 'BLACK' | 'WHITE' | 'COLOR' | 'NONE'; setZustandColor: ( newColor: 'INIT' | 'BLACK' | 'WHITE' | 'COLOR' | 'NONE', ) => void; resetFirstSurvey: () => void; } const useFirstSurveyStore = create<IFirstSurveyStore>()( persist( set => ({ zustandMonitorUsage: -1, setZustandMonitorUsage: (newUsage: -1 | 1 | 2 | 4 | 8 | 16) => set({zustandMonitorUsage: newUsage}), zustandKeyboardUsage: -1, setZustandKeyboardUsage: (newUsage: -1 | 1 | 2 | 4 | 8 | 16) => set({zustandKeyboardUsage: newUsage}), zustandMouseUsage: -1, setZustandMouseUsage: (newUsage: -1 | 1 | 2 | 4 | 8 | 16) => set({zustandMouseUsage: newUsage}), zustandTotalPrice: 0, setZustandTotalPrice: (newPrice: number) => set({zustandTotalPrice: newPrice}), zustandColor: 'INIT', setZustandColor: ( newColor: 'INIT' | 'BLACK' | 'WHITE' | 'COLOR' | 'NONE', ) => set({zustandColor: newColor}), resetFirstSurvey: () => { set({ zustandMonitorUsage: -1, zustandKeyboardUsage: -1, zustandMouseUsage: -1, zustandTotalPrice: 0, zustandColor: 'INIT', }); }, }), {name: 'FirstSurvey'}, ), ); export default useFirstSurveyStore; export type {IFirstSurveyStore}; ``` I console the zustandMonitorUsage value(i set the value to 4) but it came -1 and after it came 4 but the first value is -1, so the props go -1 I want to know why the initial value of zustand comes first
{"Voters":[{"Id":147356,"DisplayName":"larsks"},{"Id":2320961,"DisplayName":"Nic3500"},{"Id":354577,"DisplayName":"Chris"}],"SiteSpecificCloseReasonIds":[18]}
Im trying to use: df_pca_filt = df_pca[df_pca['cdf'].astype(float) > 0.975] But it doesn't work. I ran the program once and everything was fine. But then I ran it again, everything was exactly the same and it stopped filtering I tried: df_pca_filt = df_pca[df_pca['cdf'] > 0.975] df_pca_filt = df_pca[df_pca['cdf'].values > 0.975] But it gives me all the values for `df_pca['cdf']` from 0 to 1. Idk what happend I also tried using `conda upgrade pandas` in the prompt. The data type for `cdf` is `float64`
|java|spring-webflux|netty|
When I deploy angular project to gcloud, all the pages can be loaded normally, but when I refresh the page, I will get the error as the title, or if I access it directly by typing the url, it will be wrong, and I can only access it from the homepage to not make the later pages wrong, this problem has been bothering me for a long time. My route is as follows ``` const routes: Routes = [ { path: '', redirectTo: '/search/home', pathMatch: 'full'}, { path: 'search/home', component: SearchComponent }, { path: 'search/:ticker', component: SearchComponent }, { path: 'watchlist', component: WatchlistComponent }, { path: 'portfolio', component: PortfolioComponent }, ]; ``` My app.yaml file looks like this ``` runtime: nodejs20 handlers: - url: / static_files: dist/stock-app/browser/index.html upload: dist/stock-app/browser/index.html - url: / static_dir: dist/stock-app/browser ``` When I deploy angular project to gcloud, all the pages can be loaded normally, but when I refresh the page, I will get the error as the title, or if I access it directly by typing the url, it will be wrong, and I can only access it from the homepage to not make the later pages wrong, this problem has been bothering me for a long time. My route is as follows ``` const routes: Routes = [ { path: '', redirectTo: '/search/home', pathMatch: 'full'}, { path: 'search/home', component: SearchComponent }, { path: 'search/:ticker', component: SearchComponent }, { path: 'watchlist', component: WatchlistComponent }, { path: 'portfolio', component: PortfolioComponent }, ]; ``` My app.yaml file looks like this ``` runtime: nodejs20 handlers: - url: / static_files: dist/stock-app/browser/index.html upload: dist/stock-app/browser/index.html - url: / static_dir: dist/stock-app/browser ```
GoogleCloud Error: Not Found The requested URL was not found on this server
|angular|google-cloud-platform|http-status-code-404|
null
I made it work local HP = cube.Healthbar local Cooldown = false local function Healtbar() do if Cooldown then return() end HP.Value =- 5 Cooldown = true wait(0.5) Cooldown = false end cube.Touched:Connect(Healthbar)
I am new to Nextflow scripts. I am trying to build a mitochondrial DNA variant pipeline. I have used fastqc and trimmomatic tool for quality checking and trimming a low quality sequences. I have written a script below, program is executed but shows no output. #!/usr/bin/env nextflow params { fastq_dir = "/mnt/e/Bioinformatics_ppt_learning/mtDNA/nextflow_scripts/*.fastq.gz" fastqc_dir = "/mnt/e/Bioinformatics_ppt_learning/mtDNA/nextflow_scripts/fastqc_report" trimmed_dir = "/mnt/e/Bioinformatics_ppt_learning/mtDNA/nextflow_scripts/trimmed_fastq" trimmomatic_jar = "/mnt/e/Bioinformatics_ppt_learning/mtDNA/nextflow_scripts/trimmomatic-0.39.jar" } process FastQC { tag "Running FastQC on ${fastq}" publishDir "${fastqc_dir}/${fastq.baseName}" input: path fastq script: """ fastqc -o ${fastqc_dir} ${fastq} """ } process Trimmomatic { tag "Trimming ${fastq.baseName}" input: path read1 from FastQC.output output: file(joinPath(trimmed_dir, "${read1.baseName}_trimmed.fastq.gz")) script: """ java -jar ${params.trimmomatic_jar} PE -threads 4 \ ${read1} ${joinPath(trimmed_dir, "${read1.baseName}_trimmed.fastq.gz")} \ ${joinPath(trimmed_dir, "${read1.baseName}_unpaired.fastq.gz")} \ ${joinPath(trimmed_dir, "${read1.baseName}_unpaired.fastq.gz")} """ } workflow { fastq_files = Channel.fromPath(params.fastq_dir) fastq_files.each { FastQC(fastq: it) Trimmomatic(read1: FastQC.output) } }
There are multiple ways to do that, the simplest one would be to apply it using CSS .woocommerce-shop .title-container-outer-wrap{ background-image: url('YOUR_IMAGE_URL'); } I have referred to the body class `.woocommerce-shop` so that it only applies to the shop page. Another way would be to override the WooCommerce `archive-product` template. For that, you need to copy the `woocommerce/templates/archive-products.php` file inside your child theme directory and make the desired changes. https://woo.com/document/template-structure/ Follow this link for more details on template overriding.
|angular|angular12|
I have the following code in a java springboot app: ``` class myClass1 { void addToQueue() { logger.info("adding to queue"); myClass2.add(trade); } } ``` ``` class myClass2 { ConcurrentLinkedQueue<Trade> executionQueue = new ConcurrentLinkedQueue<>(); Trade tradeInExecution; void add(Trade: trade) { executionQueue.add(trade); } void execute() { var tradeInExecution = executionQueue.poll(); if (tradeInExecution == null) { return; } logger.info("executing"); // do some processing } } ``` ``` import org.springframework.scheduling.TaskScheduler; @Component public class CustomTaskScheduler { private final TaskScheduler taskScheduler; @PostConstruct public void scheduleTasks() { taskScheduler.scheduleWithFixedDelay(myClass2::execute, Instant.now(), Duration.ofMillis(100)); } } ``` I have also to add that `myClass1.addToQueue()` is getting exectued concurrently. The problem is sometimes in the log I am having "adding to queue" and no "executing" after it. How could that be happening? I am expecting for every "adding to queue" to have "executing" at some point, but some are missing "executing"
Missing update in ConcurrentLinkedQueue in Java
|java|spring-boot|
null
In your case, Sphinx generates the [LaTeX](https://www.latex-project.org/) output then calls LaTeX compiler to generate the final PDF. This means that your style is largely controlled by options given in LaTeX. For specific problems, you can also search for `LaTeX` online, not necessarily Sphinx. For example, you can search for "LaTeX figure alignment" instead of "Sphinx PDF figure alignment". To change your figure alignment, use the option `figure_align` in `latex_elements`. For example, `'figure_align': 'ht'` would put the figures at the insert point if possible, otherwise it falls back to the top of a page. You can checkout [here](https://tex.stackexchange.com/questions/8652/what-does-t-and-ht-mean) for LaTeX figure alignment. The `preamble` is a very flexible option. The contents of `preamble` is inserted at somewhere top in the generated LaTeX source file. It allows you to insert the original options provided by `LaTeX`. For example, if you want to change your table line color to red, insert the following code to your `preamble`: <!-- language: lang-tex --> \usepackage{xcolor,colortbl} \arrayrulecolor{red} Again, these resources only show up as `LaTeX` keywords resource, not Sphinx ([here](https://tex.stackexchange.com/questions/175848/changing-border-colors-of-all-tables-in-a-document)). IMO searching for your problems on the Internet in LaTeX related resource is the best way. Also, I have also written a [post](http://www.topbug.net/blog/2015/12/11/a-collection-of-issues-about-the-latex-output-in-sphinx-and-the-solutions/) related to Sphinx PDF output, which may also be helpful for you.
null
If you intend to practice infrastructure as code with Cloudformation/CDK, try out AWS CodePipeline. It'll be easier to integrate with AWS related services.
null
I have inspected the code, and I found that it's because when the screen is smaller than 576px, the pageSizeChanger will become display none. @media only screen and (max-width: 576px) { .ant-pagination .ant-pagination-options { display: none; } } Hence, I just override the antd css although its says not to override. Here's my code in `global.css` @media only screen and (max-width: 576px) { .ant-pagination .ant-pagination-options { padding-top: 10px; display: block; } }
Not sure that Polar is doing this natively. I could get close to your original chart by adding "fakes-null" values : <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> <script> const ctx = document.getElementById('myChart').getContext('2d'); const myChart = new Chart(ctx, { type: 'polarArea', data: { datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }, { label: '# of Second Votes', data: [0,15,0,0, 30,0,0, 12,0,0, 13,0,0, 11,0,0, 12,0], backgroundColor: [ 'rgba(0, 0, 0, 0)', 'rgba(255, 99, 132, 1)', 'rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0)', 'rgba(54, 162, 235, 1)', 'rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0)', 'rgba(255, 206, 86, 1)', 'rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0)', 'rgba(75, 192, 192, 1)', 'rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0)', 'rgba(153, 102, 255, 1)', 'rgba(0, 0, 0, 0)', 'rgba(0, 0, 0, 0)', 'rgba(255, 159, 64, 1)', 'rgba(0, 0, 0, 0)' ], borderWidth: 1, hidden: false }] }, options: { scales: { r: { beginAtZero: true } } } }); </script> <!-- end snippet -->
Nextflow script for performing quality control and trimming the sequence
|nextflow|fastq|
When I deploy angular project to gcloud, all the pages can be loaded normally, but when I refresh the page, I will get the error as the title, or if I access it directly by typing the url, it will be wrong, and I can only access it from the homepage to not make the later pages wrong, this problem has been bothering me for a long time. My route is as follows ``` const routes: Routes = [ { path: '', redirectTo: '/search/home', pathMatch: 'full'}, { path: 'search/home', component: SearchComponent }, { path: 'search/:ticker', component: SearchComponent }, { path: 'watchlist', component: WatchlistComponent }, { path: 'portfolio', component: PortfolioComponent }, ]; ``` My app.yaml file looks like this ``` runtime: nodejs20 handlers: - url: / static_files: dist/stock-app/browser/index.html upload: dist/stock-app/browser/index.html - url: / static_dir: dist/stock-app/browser ```
The following are the related lines of my query that I have a problem I cannot resolve: IF (servicesalesdetailsopen_v.complaintcode LIKE 'IVWIP', 'Y', 'N') as intflag LEFT JOIN servicesalesdetailsopen_v ON servicesalesopen_v.ronumber = servicesalesdetailsopen_v.ronumber and servicesalesopen_v.vehid = servicesalesdetailsopen_v.vehid and servicesalesdetailsopen_v.cora_acct_code = 'XXX-S' The query brings back accurate results but line by line for detailed line items within the servicesalesdetailsopen table. I only want a Y set as intflag if IVWIP is on ANY row in the servicesalesopen_v.complaintcode for the repair orders and it brings back every line item with a Y or an N for each line. I would like the result in one line by RO. How do I accomplish one line results by RO? This is ongoing. I don't want to have to address it when it's imported into another database.
MySql Condition Clause resulting in every joined line from joined table based on column value
|mysql|if-statement|left-join|
null
I ran into a problem when I decided to make a server for microservices, but I ran into the problem that my microservice cannot register in Eureka, what could be wrong? ``` apiVersion: v1 kind: ConfigMap metadata: name: configmap data: foodcataloguedb_url: jdbc:postgresql://35.228.167.123:5432/foodcataloguedb orderdb_url: mongodb+srv://admin:219528Kirsing@atlas-cluster.st0oaiy.mongodb.net/ restaurantdb_url: jdbc:postgresql://35.228.167.123:5432/restaurantdb userdb_url: jdbc:postgresql://35.228.167.123:5432/userdb EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: "http://eureka:8761/eureka/" GATEWAY_APPLICATION_NAME: gateway ``` ``` apiVersion: apps/v1 kind: Deployment metadata: name: gateway labels: app: gateway spec: replicas: 1 selector: matchLabels: app: gateway template: metadata: labels: app: gateway spec: containers: - name: gateway image: kirsing123/gateway:v1.4 imagePullPolicy: Always ports: - containerPort: 8072 env: - name: SPRING_APPLICATION_NAME valueFrom: configMapKeyRef: name: configmap key: GATEWAY_APPLICATION_NAME - name: EUREKA_CLIENT_SERVICEURL_DEFAULTZONE valueFrom: configMapKeyRef: name: configmap key: EUREKA_CLIENT_SERVICEURL_DEFAULTZONE --- apiVersion: v1 kind: Service metadata: name: gateway spec: selector: app: gateway type: LoadBalancer ports: - protocol: TCP port: 8072 targetPort: 8072 ``` [enter image description here](https://i.stack.imgur.com/dElHe.png) [enter image description here](https://i.stack.imgur.com/uqnY8.png) I changed dependencies and turned the @EnableDiscoveryClient annotation on and off, to no avail
|android|wifi|android-13|
How to implement the patterns array in the urlManager of web.php?
Swiss-sched. help! please I am working on scheduling 8 showcases for the year. I have dataframes for each showcase that have rank and conference from where each player is from. Each showcase has a different number of players registered but it is always a different number of players. Ex. 48, 20 players. There can be some players that participate in multiple showcases or all 8. The ranks never change. They are set at the beginning of the year. In each showcase there are 3 rounds and all players have to play one game in each round. Players cannot play each other more than once throughout the entire year and cannot play another player from the same conference. The matches for players are to be determined by similar rankings. I've been trying to use a swiss system to schedule the games in python and I am able to generate out but it is not consistent as not all opponents are matched up in each round. I believe it is because we have an extra constraint that being 'conferences' where in a regular swiss system it is only constrained by 'rank'. The system has to be constrained by both 'rank' and 'conference'. Does anyone have any suggestions on any packages or types of algorithms that I could use? Or if you think there is a better way to tackle this problem. Thanks!!! ++++ Edit ++++ Okay to be honest I'm not sure where the problem is so I'm just going to inlcude the first part: Here is what I did: class Player: def __init__(self, name, rating, area): self.name = name self.rating = rating self.area = area self.games_played = 0 def optimize_pairings(players, pairings_history, round_num): # Ensure players list contains only Player objects if not all(isinstance(player, Player) for player in players): raise ValueError("Invalid player objects in the players list.") # Create a binary variable for each pair of players pair_vars = pulp.LpVariable.dicts("Pair", ((p1, p2) for p1 in players for p2 in players if p1 != p2), cat='Binary') # Create a PuLP minimization problem prob = pulp.LpProblem("Pairing Optimization", pulp.LpMinimize) # Objective: minimize the total rating difference between paired players prob += pulp.lpSum(pair_vars[(p1, p2)] * abs(p1.rating - p2.rating) for p1 in players for p2 in players if p1 != p2) # Add constraints for p1 in players: prob += pulp.lpSum(pair_vars[(p1, p2)] for p2 in players if p1 != p2) == 1 # Each player is paired with exactly one opponent for p1 in players: for p2 in players: if p1 != p2: prob += pair_vars[(p1, p2)] + pair_vars[(p2, p1)] <= 1 # No rematches between tournaments for p1 in players: for p2 in players: if p1 != p2: if p1.area == p2.area: prob += pair_vars[(p1, p2)] == 0 # No player can play an opponent from the same conference # Exclude pairings already used in previous tournaments for (p1, p2) in pair_vars.keys(): if (p1, p2) in pairings_history or (p2, p1) in pairings_history: prob += pair_vars[(p1, p2)] == 0 # Solve the ILP problem prob.solve() # Extract pairings from the solution paired_players = [(p1, p2) for (p1, p2), var in pair_vars.items() if pulp.value(var) == 1] # Update pairings history for the current round pairings_history.update({(p1, p2) for (p1, p2) in paired_players}) return paired_players Here is also the link to an example of the [results/data][1]. [1]: https://docs.google.com/spreadsheets/d/1Gr8N7cAdDeEdb7hGj1Ha0w9y83Xd1tuGf5h4Klw_W3g/edit?usp=sharing
**One line to get it.** In the terminal type this command **`gradle signingReport`** > **very important** **press** <kbd>Ctrl</kbd> + <kbd>enter</kbd> ⚠ not <kbd>enter</kbd> only Work with Mac And Windows
I just started to work with LED matrix (16*16) and attiny85. The current purpose is to switch on a led on each row, where led number is the number of row (I know that led strip is like a snake, it does not matter for now). So, I written an `byte matrix[16][16]` and manually put a digit into target cells. It worked well. After that I replace `byte matrix[16][16]` into a `rgb matrix[16][16]` where `struct rgb {byte r, byte g, byte b}` and it doesn\`t work correctly (see photos below). The LED functions: ``` #define LED PB0 #define byte unsigned char struct rgb { byte r; byte g; byte b; }; void setBitHigh(byte pin) { PORTB |= _BV(pin); // 1 tactDuration asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop"); PORTB &= ~_BV(pin); // 1 tactDuration asm("nop"); asm("nop"); } void setBitLow(byte pin) { PORTB |= _BV(pin); // 1 tactDuration asm("nop"); asm("nop"); PORTB &= ~_BV(pin); // 1 tactDuration asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop"); } void trueByte(byte pin, byte intensity) { for (int i = 7; i >= 0; i--) { intensity & _BV(i) ? setBitHigh(pin) : setBitLow(pin); } } void falseByte(byte pin) { for (int i = 0; i < 8; i++) { setBitLow(pin); } } void setPixel(byte pin, rgb color) { DDRB |= _BV(pin); color.g > 0 ? trueByte(pin, color.g) : falseByte(pin); color.r > 0 ? trueByte(pin, color.r) : falseByte(pin); color.b > 0 ? trueByte(pin, color.b) : falseByte(pin); } ``` working well code: ``` void display(byte matrix[WIDTH][HEIGHT]) { for (byte rowIdx = 0; rowIdx < WIDTH; rowIdx++) { for (byte cellIdx = 0; cellIdx < HEIGHT; cellIdx++) { setPixel(LED, {matrix[rowIdx][cellIdx], 0, 0}); } } } byte m[WIDTH][HEIGHT] = { { 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, ... { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15} }; int main() { display(m); } ``` result: [![enter image description here][1]][1] NOT working well code: ``` void display(rgb matrix[WIDTH][HEIGHT]) { for (byte rowIdx = 0; rowIdx < WIDTH; rowIdx++) { for (byte cellIdx = 0; cellIdx < HEIGHT; cellIdx++) { setPixel(LED, matrix[rowIdx][cellIdx]); } } } rgb m[WIDTH][HEIGHT] = { { {15, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }, ... }; int main() { display(m); } ``` result: [![enter image description here][2]][2] I will be glad to any advice... [1]: https://i.stack.imgur.com/c7dW8.jpg [2]: https://i.stack.imgur.com/0ykNX.jpg
I'm using bootstrap to create a grid of cards, but all the cards are merging together when resizing the screen. This mainly happened when i tried to layout the icons to appear at the top left of the card and the bottom middle whilst adding a a href tag to the image. <div class="col-sm-6 col-md mt-3"> <div class="card" style="position: relative;"> <a href="#" style="position: absolute; top: 0; left: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none;"> <img src="https://images.igdb.com/igdb/image/upload/t_cover_big/co7lbb.png" alt="" style="pointer-events: auto;"> </a> <div class="icon-placeholder" style="position: absolute; top: 0; left: 0; z-index: 3;"> <!-- Heart icon on top left --> <i id="heart" class="fas fa-heart heart-icon top-left-icon"></i> <!-- Other icons on bottom --> <div class="bottom-icons" style="position: absolute; bottom: -300px; left:100px;"> <i class="fas fa-comment comment-icon p-2"></i> <i class="fas fa-share share-icon p-2"></i> <!-- ... add more icons as needed --> </div> </div> </div> </div> <div class="col-sm-6 col-md mt-3"> <div class="card" style="position: relative;"> <a href="#" style="position: absolute; top: 0; left: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none;"> <img src="https://images.igdb.com/igdb/image/upload/t_cover_big/co7lbb.png" alt="" style="pointer-events: auto;"> </a> <div class="icon-placeholder" style="position: absolute; top: 0; left: 0; z-index: 3;"> <!-- Heart icon on top left --> <i id="heart" class="fas fa-heart heart-icon top-left-icon"></i> <!-- Other icons on bottom --> <div class="bottom-icons" style="position: absolute; bottom: -300px; left:100px;"> <i class="fas fa-comment comment-icon p-2"></i> <i class="fas fa-share share-icon p-2"></i> <!-- ... add more icons as needed --> </div> </div> </div> </div> ---- CSS stylesheet ---- ``` .bottom-icons { display: flex; justify-content: space-evenly; margin-top: auto; /* Push the bottom icons to the bottom */ } .icon-placeholder { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; justify-content: space-between; width: 100%; height: 100%; padding: 10px; box-sizing: border-box; } .card img { border-radius: 20px; max-height: 320px; max-width: 320px; object-fit: cover; display: block; } .card { position: relative; border-radius: 20px; background-color: #ffffff00; max-width: 264px; max-height: 352px; transition: transform .2s; /* Add transition property for smooth animation */ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); }
Handling and ignore UNKNOWN_TOPIC_OR_PARTITION error in Kafka Streams
|java|apache-kafka|apache-kafka-streams|
null
edSubject.aggregate([ { $match: { stageid: stageid, boardid: boardid, scholarshipid: scholarshipid, }, }, { $lookup: { from: "edcontentmasterschemas", let: { stageid: "$stageid", subjectid: "$subjectid", boardid: "$boardid", scholarshipid: "$scholarshipid", }, pipeline: [ { $match: { $expr: { $and: [ { $eq: ["$stageid", "$$stageid"] }, { $eq: ["$subjectid", "$$subjectid"] }, { $eq: ["$boardid", "$$boardid"] }, { $eq: ["$scholarshipid", "$$scholarshipid"] }, ], }, }, }, { $addFields: { convertedField: { $cond: { if: { $eq: ["$slcontent", ""] }, then: "$slcontent", else: { $toInt: "$slcontent" }, }, }, }, }, { $sort: { slcontent: 1 } }, { $group: { _id: "$topicid", topicimage: { $first: "$topicimage" }, topic: { $first: "$topic" }, sltopic: { $first: "$sltopic" }, studenttopic: { $first: "$studenttopic" }, reviewquestionsets: { $push: { id: "$_id", sub: "$sub", topic: "$topic", contentset: "$contentset", stage: "$stage", timeDuration: "$timeDuration", contentid: "$contentid", studentdata: "$studentdata", subjectIamge: "$subjectIamge", topicImage: "$topicImage", contentImage: "$contentImage", isPremium: "$isPremium", }, }, }, }, { $addFields: { convertedField: { $cond: { if: { $eq: ["$slcontent", ""] }, then: "$slcontent", else: { $toInt: "$slcontent" }, }, }, }, }, { $sort: { sltopic: 1 } }, { $lookup: { from: "edchildrevisioncompleteschemas", let: { childid: childid, //childid, //subjectid, topicid: "$_id" }, pipeline: [ { $match: { $expr: { $and: [ { $eq: [ "$childid", "$$childid" ] }, { $in: [ "$$topicid", { $reduce: { input: "$subjectDetails", initialValue: [], in: { $concatArrays: [ "$$value", "$$this.topicDetails.topicid" ] } } } ] } ] } } }, { $project: { _id: 1, childid: 1 } } ], as: "studenttopic" } }, { $project: { _id: 0, topic: "$_id", topicimage: 1, topicid: 1, sltopic: 1, studenttopic: 1, contentid: "$contentid", reviewquestionsets: 1, }, }, ], as: "topicDetails", }, }, { $unwind: "$topicDetails" }, // Unwind to transform topicDetails into an array { $group: { _id: "$_id", subject: { $first: "$subject" }, subjectid: { $first: "$subjectid" }, slsubject: { $first: "$slsubject" }, topicDetails: { $push: "$topicDetails" }, // Push each topicDetails into an array // Add other fields you want to preserve in the document }, }, ])
id: { allowNull: false, autoIncrement: true, primaryKey: true, type: Sequelize.INTEGER }, UserId: { allowNull: false, type: Sequelize.INTEGER, references: { model: "Users", key: "id" } }, HeroId: { allowNull: false, type: Sequelize.INTEGER, references: { model: "Heros", key: "id" } }, match: { allowNull: false, type: Sequelize.INTEGER }, status: { allowNull: false, type: Sequelize.STRING }, createdAt: { allowNull: false, type: Sequelize.DATE }, updatedAt: { allowNull: false, type: Sequelize.DATE } });
I found this post and tried to use the RAND() function to solve this issue as a trigger. I wanted the same idea: resulting BLANK when there is no match. So, my solution was replacing RAND() by IF(RAND()*0=0,"","") With that, I have the trigger and the result as BLANK. It worked!
Why don't you try to format the columns as per your requirement and overwrite it your file with formatted columns? df.to_excel(<path to file>, index = False)
It's been 2 years but hope this helps, at least, it worked for me. If you have the country boundaries GeoJSON (Multipolygon Feature). You may use @turf import { featureEach, difference, buffer } from '@turf/turf'; const getInverseFeature = (featureCollection, distance) => { // Create a bounding box for the entire world let invertedPolygon; // Loop through each feature in the FeatureCollection featureEach(featureCollection, (feature) => { // Buffer the feature polygon slightly to ensure it covers the boundaries const bufferedFeature = buffer(feature, 40, { units: 'kilometers' }); //You may use distance instead of 40 km // Convert the buffered feature to a GeoJSON polygon const featurePolygon = bufferedFeature; // If invertedPolygon already exists, subtract the current feature polygon from it if (invertedPolygon) { invertedPolygon = difference(invertedPolygon, featurePolygon); } else { // Otherwise, initialize invertedPolygon with the first feature polygon invertedPolygon = featurePolygon; } }); // Subtract the inverted polygon from the world bounding box const worldPolygon = { type: 'Polygon', coordinates: [ [ [-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90], ], ], }; return difference(worldPolygon, invertedPolygon); }; With the help of function you can get inverse feature and (In React I used the GeoJSON component) <GeoJSON data={outterBounds} pathOptions={{ color: mapChange ? '#163a4a' : '#aad3df', // weight: 2.5, lineCap: 'round', fill: true, fillOpacity: 0.98, }} /> But this is important to know, you shouldn't use the function in Frontend, because it is a very slow function and will freeze the brower. To use the inverse feature you may use one of the following options. 1- Generate Inverse Feature in Backend and return the result from backend to frontend (By the way, the FeatureCollection at function is the Feature Collection of the Country Coastline (Borderlines of the country)) 2- You may use it at frontend just once, console log the Reverse Feature to DevTools console, copy the object and create a country outter bounds constant and import it to the file which you will generate the map and use GeoJSON. 3- Use the second option, add copied object to DB and fetch it from DB (again you will get the data from Backend but this time you do not need to use the above function calculation again and again. Result from the above (I used 2nd option by the way) : [enter image description here][1] [1]: https://i.stack.imgur.com/mvpUF.png
can someone explain why i am getting this error C:\Users\server\node_modules\razorpay\dist\razorpay.js:33 throw new Error('`key_id` is mandatory'); ^ Error: `key_id` is mandatory at new Razorpay (C:\Users\server\node_modules\razorpay\dist\razorpay.js:33:13) at Object.<anonymous> (C:\Users\server\config\paymentConfig\razorPayConfig.js:3:18) const instance = new Razorpay({`your text` key_id: process.env.RAZOR_PAY_KEY_ID, key_secret: process.env.RAZOR_PAY_KEY_SECRET, });`your text` if i use key_id directly i am not getting any error, but if use `process.env.RAZOR_PAY_KEY_ID` iam getting this error, but if i log `process.env.RAZOR_PAY_KEY_ID` and `process.env.RAZOR_PAY_KEY_SECRET` i am getting proper values
null
I have the same issue on .net 8 V4 isolated Azure function app that uses cosmos db triggers. Works locally every time, when deployed it fails to trigger. I can see storage exceptions in kudu logs: ```"processUptime": 141524, "functionAppContentEditingState": "Unknown" } 2024-03-05T12:08:06 PID[4860] Error 3/5/2024 12:08:06 PM Encountered exception while validating SAS URI System.Exception:Azure storage account must be configured at DaaS.Storage.AzureStorageService.ValidateStorageConfiguration(String& storageAccount, Exception& exceptionContactingStorage) 2024-03-05T12:08:06 PID[4860] Error 3/5/2024 12:08:06 PM Invalid storage configuration System.Exception:Azure storage account must be configured at DaaS.Storage.AzureStorageService.ValidateStorageConfiguration(String& storageAccount, Exception& exceptionContactingStorage) ``` I have tested storage connection string locally and works fine, feels like an SDK issue to me.
null
Hope, This will help, you can try once. Step 1: Created a Animate segment Controller view struct AnimatedSegmentedControl: View { let items: [String] @Binding var selectedItemIndex: Int var body: some View { GeometryReader { geometry in HStack(spacing: 0) { ForEach(items.indices) { index in Button(action: { withAnimation { self.selectedItemIndex = index } }) { VStack{ Text(items[index]) .font(.headline) .padding() .foregroundColor(index == selectedItemIndex ? Color(hex: "0F4D80", alpha: 1.0) : Color(hex: "35353A", alpha: 1.0)) ZStack { Capsule() .fill(Color.clear) .frame(height: 2) if index == selectedItemIndex { Capsule() .fill(Color(hex: "0F4D80", alpha: 1.0)) .frame(height: 2) } } } } .frame(width: geometry.size.width / CGFloat(items.count)) .background(Color.clear) } Rectangle() .frame(width: geometry.size.width / CGFloat(items.count), height: 2) .foregroundColor(.blue) .offset(x: CGFloat(selectedItemIndex) * (geometry.size.width / CGFloat(items.count))) } // .animation(.easeInOut) } .frame(height: 50) }} Step 2: call from main view to segment view struct TestView: View { @State private var selectedItemIndex = 0 let items = ["History", "Favorites"] var body: some View { VStack { AnimatedSegmentedControl(items: items, selectedItemIndex: $selectedItemIndex) Spacer() if selectedItemIndex == 1 { Text("History items containt details display here..") } else { Text("Favorite items containt Details display here..") } Spacer() } } } struct TestView_Previews: PreviewProvider { static var previews: some View { TestView() }} Below code will change from hexa to color. extension Color { init(hex: String, alpha: Double = 1.0) { var formattedHex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted) if formattedHex.hasPrefix("#") { formattedHex.remove(at: formattedHex.startIndex) } let scanner = Scanner(string: formattedHex) var hexNumber: UInt64 = 0 if scanner.scanHexInt64(&hexNumber) { self.init( .sRGB, red: Double((hexNumber & 0xFF0000) >> 16) / 255.0, green: Double((hexNumber & 0x00FF00) >> 8) / 255.0, blue: Double(hexNumber & 0x0000FF) / 255.0, opacity: alpha ) return } // Fallback color (black) if invalid hex string self.init(.sRGB, red: 0, green: 0, blue: 0, opacity: 1.0) }} **You can see the screenshot below** [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/9PRUY.png
Bootstrap card not collapsing with other cards and merging with cards
|css|flexbox|bootstrap-5|
NextJS is a superset of React WITH new features and strategy of bundling/optimization. so all features has in React is applicable. you might want to read as well their [features][0] Happy Coding! [0]: https://nextjs.org/docs
the input is: [input of sample data](https://i.stack.imgur.com/akaB9.png) need output as: [enter image description here](https://i.stack.imgur.com/tyeiB.png) is this possible in just XL format or a python script is required. if yes can you help with python script? thanks. my script: my logic is read each df.col and compare value from 1 to 20, if equal write it out or write blank. import pandas as pd df = pd.read_excel(r"C:\Users\my\scripts\test-file.xlsx") print(df) for column in df.columns[0:]: print(df[column])
|python|input|numeric|reformat|
if you can change also `name` column : select * from sample1 where substring(name, 1, 1) between 'a' AND 'z' **if you have many records, using rpad my degrade performance**
1. Yes, any node is fine as the driver immediately knows the entire topology of the cluster as soon as it connects to the "contact points" to make the initial handshake 2. Connecting to multiple-datacenters via the same client is always a bad idea. The setup should be to connect the local region/datacenter based application microservices to the same C* region/datacenter for locality purposes. Anyways, during a failover time assuming an entire cloud region goes for a toss, the application services will also be down along with the cluster's datacenter. So, the failover will happen at a layer above these, like a load balancer that will route the traffic to the appropriate region services (app + db). Also, this is the reason we are providing the local datacenter when creating a client. See the below image for a reference (courtesy of DataStax) [![enter image description here][1]][1] 3. I don't understand what bandwidth we're referring here. If you could update your question and provide clarity, maybe we could try to update our answer accordingly. [1]: https://i.stack.imgur.com/2TakR.png
I have this Accordion , and for some reason my transition not working on Accordion Item component. Please help me , I'm during learning process of React. CODE WITH CSS BELOW PS. Console log shows that onclick both classes with transtion are added , but not performing CSS ``` .accordion { display: flex; // justify-content: space-between; align-content: center; align-items: center; text-align: center; flex-direction: column; width: 100%; height: 100%; background-color: linear-gradient(#bdc3c7, #2c3e50); h1 { letter-spacing: 0.04rem; margin: 15px; font-size: 4rem; } .classContainer { display: flex; justify-content: center; flex-direction: column; align-items: center; width: 100%; .accordionItem { display: flex; flex-direction: column; justify-content: center; transition: max-height 5s ease-out; max-height: 0; width: 98%; // overflow: hidden; border-radius: 4px; &.animated { max-height: 450px; transition: max-height 5s ease-in; background-color: green; } label { font-weight: 600; text-align: left; margin-bottom: 5px; padding: 8px 0px 8px 8px; } input { background-color: red; width: 50%; height: 30px; margin: 4px 0px 4px 4px; border: solid 1px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; -o-border-radius: 4px; } } } } import styles from "./index.module.scss"; import dataForVendors from "../../VendorDataArray"; import AccordionItem from "../AccordionItem"; import { useState } from "react"; import AccordionCard from "../AccordionCard"; const VendorCard = () => { /// Function to create unique values array const uniqueVendors = dataForVendors.filter(function (item, index) { return ( index === dataForVendors.findIndex(function (obj) { return item.name === obj.name; }) ); }); // Function to group the obejct with same names /// Array of objects nested structure tree const groupedVendors = []; for (const uniq of uniqueVendors) { const structure = { vendor_id: uniq.id, vendor_name: uniq.name, group: [], }; dataForVendors.forEach((v) => { if (v.name === uniq.name) { structure.group.push(v); } }); groupedVendors.push(structure); } // Accordion component the one is not visible const AccordionItem = ({ activeIndex }) => { return ( <div className={ !activeIndex ? `${styles.accordionItem} ${styles.animated} ` : "" } > <label htmlFor="myInput">Name</label> <input type="text" /> <label htmlFor="">Category</label> <input type="text" /> <label htmlFor="">Address</label> <input type="text" /> <label htmlFor="">Latitude</label> <input type="text" /> <label htmlFor="">Longitude</label> <input type="text" /> </div> ); }; // Function to show div with input and details const [activeIndex, setActiveIndex] = useState(-1); const handleClick = (index) => { setActiveIndex(index === activeIndex ? -1 : index); }; return ( <div className={styles.accordion}> <h1>Vendors</h1> {groupedVendors.map((card, index) => ( <div key={card.vendor_id} className={styles.classContainer} onClick={() => handleClick(index)} > <AccordionCard> <h3>{card.vendor_name}</h3> </AccordionCard> {/* <div className={styles.vendorData}></div> */} {index === activeIndex && <AccordionItem />} </div> ))} </div> ); }; export default VendorCard; ``` Itry set state and max-height and didin't work . I want accordion item expend with transition and back with it
df filter is not filtering
|python|pandas|
When you want to add R packages to a new OS running R, you need to be aware of any underlying OS packages that are required. In this case, reading `sf`'s [`DESCRIPTION`](https://cran.r-project.org/web/packages/sf/index.html), we see ``` SystemRequirements: GDAL (>= 2.0.1), GEOS (>= 3.4.0), PROJ (>= 4.8.0), sqlite3 ``` It's not always intuitive how to know what these labels mean. One place you might look for a hint about this is Posit's [Package Manager](https://packagemanager.posit.co/client/#/repos/cran/packages/overview?search=sf), which lists the following OS requirements on Ubuntu 22.04 (on which `rocker/shiny` is based). ``` apt-get install -y libgdal-dev apt-get install -y gdal-bin apt-get install -y libgeos-dev apt-get install -y libproj-dev apt-get install -y libsqlite3-dev apt-get install -y libssl-dev apt-get install -y libudunits2-dev ``` Many of those are likely already present. First, let me reproduce the problem: ```bash $ docker build -t quux . $ docker run -it --rm quux R --quiet > library("sf") Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/usr/local/lib/R/site-library/units/libs/units.so': libudunits2.so.0: cannot open shared object file: No such file or directory ``` Through experience, I know that Jammy (22.04) needs these packages for R's `sf` package, add these lines somewhere in your `Dockerfile`: ```docker # ... RUN apt-get update && \ apt-get install -y libproj22 libudunits2-0 libgdal30 && \ rm -rf /var/lib/apt/lists/* RUN R -e "install.packages('sf')" ``` Notes: 1. Whether or not you join those with previous `apt` and `install.packages(..)` commands are up to you. 2. I encourage you to review https://docs.docker.com/develop/develop-images/instructions/ for "best practices", especially when installing OS-level packages, attempting to balance that with image size (ergo the `rm -rf` command). It now works: ```bash $ docker build -t quux . $ docker run -it --rm quux R --quiet > library("sf") Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE ```
null
I'm trying to build adb for ARM, but I couldn't find the adb folder in the platform_system_core repository at https://github.com/aosp-mirror/platform_system_core/tree/master. I've also tried cloning the official repository at https://android.googlesource.com/platform/system/core, but the adb folder does not exist there either. Has the path changed? Can you tell me where to find the source code of adb and how to build it for ARM?
How can I build ADB ARM myself?
|android|adb|
null
The tooltip column needs to come after the column you intend to modify the tooltip for. It modifies the tooltip of the previous column, so moving the tooltip column to the end like this: data.addColumn('string', 'sdfgadfg'); data.addColumn('number', '2023'); data.addColumn('number', '2024'); data.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}}); data.addRows([ ['Jan', 165, 614.6, createCustomHTMLContent()] ...]); Provides a tooltip for the line graph at the data point 614.6 for Jan. You would need to add another column for the bar graph tooltip in between the 2023 and 2024 columns. https://developers.google.com/chart/interactive/docs/roles
No, I don't have any examples of "open source" websites to share. Usually open source projects are open source because they want to accept community contributions, and if they're serious about receiving such contributions they're of course going to have a setup guide somewhere to get contributors started.
null
I am attempting to use Spatie to create a backup from a controller. It works correctly when I make a copy of only the files. However, an error occurs when I try to create a database copy. Interestingly, the file and database copies are created correctly from the console. I suspect the issue might be related to not having access to mysqldump.exe. Initially, I could not create backups from the console until I added the path to mysqldump.exe to the environment variables. I am developing on a Windows platform and using XAMPP. Do you know if anyone has any insights into this problem? public function backup() { $exitCode = Artisan::call("backup:run"); if($exitCode == 0) return 'Backup Creado Correctamente.'; else return 'Ocurrió un error al crear el backup.'; }
I am trying to pull data using urllib and tableau_api_lib to create PDFs based off of filtered data of a view within Tableau. I have THAT part working, but I need help with looping through the list of IDs to then create a dictionary (that is needed to create the PDF), then off of those parameters, create output that changes the PDF name as the same as the ID in the test_loop. I can make it work with just one record (without the loop). ``` test_loop = ['202','475','78','20','10'] for item in test_loop: tableau_filter_value = parse.quote(item) pdf_params = { "pdf_orientation":"orientation=Landscape", "pdf_layout":"type=A4", "filter_vendor": f"vf_{tableau_filter_field}={tableau_filter_value}", } for params in pdf_params: with open('output{test}.pdf'.format(test=params),'wb') as file: file.write(conn.query_view_pdf(view_id = pdf_view_id, parameter_dict=params).content) ``` Basically, the PDF should be named as output202.pdf and should have the data associated with it from the pdf_params dict above. So the output, I am expecting 5 different pdfs with this list. I am somewhat new to python, so anything helps! AttributeError: 'str' object has no attribute 'keys'
How to loop through list of values to then create PDFs in Python
|python|for-loop|pdf-generation|tableau-api|urllib|
null
Why does my WiFi connection code not work on Android 13?
{"Voters":[{"Id":2943403,"DisplayName":"mickmackusa"},{"Id":794749,"DisplayName":"gre_gor"},{"Id":1255289,"DisplayName":"miken32"}],"SiteSpecificCloseReasonIds":[11]}
I want to use FFDShow to upscale a stereo stream from one of the audio inputs on my computer using the PLII implementation. I can't seem to find any examples on how to use FFDShow with .net anywhere. I found this post from a guy that created a couple of projects, I written him but he haven't been online since 2011, do anyone have these projects or know how to use FFDShow with .Net. http://forum.doom9.net/showthread.php?p=1270421#post1270421 Thanks
Try using instead `<c-w>` (which is <kbd>Ctrl</kbd> + <kbd>W</kbd>) to erase words or `<c-u>` (<kbd>Ctrl</kbd> + <kbd>U</kbd>) to delete lines. See also [another answer](https://stackoverflow.com/a/73444171/22330192) below.
null
Try using instead `<c-w>` (which is <kbd>Ctrl</kbd> + <kbd>W</kbd>) to erase words or `<c-u>` (<kbd>Ctrl</kbd> + <kbd>U</kbd>) to delete lines.
This problem is often called 'assigning agents to tasks'. There are several algorithms that can solve this. I use the Ford-Fulkerson Maximum Flow Algorithm ( theory.stanford.edu/~tim/w16/l/l1.pdf ) The trick is, as always, adapting the algorithm to your particular constraints so that the max flow algorithm operates without violating any of them. I do not understand some of your constraints ( 'workdays' in particular, see my comments on your question for the clarifications needed ). So I cannot apply all your constraints. But, I thought you might find it useful to see some code ( C++, sorry ) implementing the max flow allocation applied to a simplified version of your problem. This code uses the implementation of Ford-Fulkerson supplied by the PathFinder graph theory library. ( https://github.com/JamesBremner/PathFinder ) ```C++ #include <string> #include <fstream> #include <sstream> #include <iostream> #include <vector> #include <set> #include <algorithm> #include "GraphTheory.h" class cAgent { public: std::string myID; std::vector<std::string> myTasks; bool cando( const std::string& task ) { return std::find( myTasks.begin(),myTasks.end(), task ) != myTasks.end(); } }; std::set<std::string> theTasks; std::vector<cAgent> theAgents; void readfile() { std::ifstream ifs("../dat/data1.txt"); if (!ifs.is_open()) throw std::runtime_error( "Cannot read input"); std::string line; while (getline(ifs, line)) { // std::cout << line << "\n"; if (line.find("id:") != -1) { int p = line.find("\""); int q = line.find("\"", p + 1); line = line.substr(p + 1, q - p - 1); if (line[0] == 'T') { cAgent A; A.myID = line; theAgents.push_back(A); } } else if (line.find("subjects:") != -1) { int p = line.find("\"", p + 1); while (p != -1) { int q = line.find("\"", p + 1); auto task = line.substr(p + 1, q - p - 1); theTasks.insert(task); theAgents.back().myTasks.push_back(task); p = line.find("\"", q + 1); } } else if (line.find("const subjects") != -1) break; } std::cout << "Teachers:\n "; for (auto &a : theAgents) { std::cout << a.myID << " can teach "; for (auto &t : a.myTasks) std::cout << t << " "; std::cout << "\n"; } } void allocateMaxFlow() { raven::graph::cGraph g; g.directed(); // loop over the tasks for (auto & task : theTasks) { // loop over agents that can do task for (cAgent &a : theAgents) { if( ! a.cando( task )) continue; // add link from agent to task agent is able to do g.add( a.myID, task ); } } // apply pathfinder maximum flow allocation algorithm raven::graph::sGraphData gd; gd.g = g; auto sg = alloc(gd); std::cout << "\nAssignments:\n"; for (std::pair<int, int> p : sg.edgeList()) { std::cout << "teacher " << sg.userName(p.first ) << " assigned to " << sg.userName (p.second) << "\n"; } } main() { readfile(); allocateMaxFlow(); return 0; } ``` The output from this is ``` Teachers: T1 can teach M1 M2 M3 T2 can teach Q1 Q2 Q3 T3 can teach I1 I2 I3 T4 can teach B1 B2 B3 T5 can teach H1 T6 can teach P1 P2 P3 T7 can teach I1 I2 I3 T8 can teach C1 C2 C3 T9 can teach M1 T10 can teach A1 A2 Assignments: teacher T10 assigned to A1 teacher T4 assigned to B1 teacher T8 assigned to C1 teacher T5 assigned to H1 teacher T3 assigned to I1 teacher T7 assigned to I2 teacher T9 assigned to M1 teacher T1 assigned to M2 teacher T6 assigned to P1 teacher T2 assigned to Q1 ``` You can find the complete project at https://github.com/JamesBremner/78250368
I need help converting a column of 179 observations from an excel file that holds 2 variables (days and values). After i try converting the dataframe with ts(as.vector(a1dataraw['x'], the vector returns with start=1 but also end=1 when it should be 179? Can someone please identify where im going wrong? library(TSA) #Load data a1dataraw <- read.csv("assignment1data2024.csv", header=TRUE) a1dataraw #Convert to TS a1data <- NA a1data <- ts(as.vector(a1dataraw['x']), # Read correct column, which is 'x' here. start= 1) a1data [![Code input](https://i.stack.imgur.com/VVfRE.png)](https://i.stack.imgur.com/VVfRE.png) [![Code output](https://i.stack.imgur.com/U4IAO.png)](https://i.stack.imgur.com/U4IAO.png) The end value is 1 when it should be 179? The csv file has 2 columns with headers Trading days and x for the observations
The ts() function in R is returning the correct start and frequency but not end value which is 1 and not 179
|r|basic|
null
<s>Most likely the `int32_t * SIZE` in the `malloc` call. If you use a bit-shift like `SIZE << 2` instead, your code should be much faster and more efficient.</s> OK, in all seriousness, `a_ptr`, `b_ptr`, and `c_ptr` are all separate blocks of memory. In your loop you are accessing one, then the other, then the other, then repeating. I hear that is like bad for cache or something, because you are jumping around in memory, instead of accessing them sequentially. I am skeptical that, even if a human could predict that pattern, a CPU could.
Why don't you try to format the columns as per your requirement and overwrite your file with formatted columns? df.to_excel(<path to file>, index = False)
I'm having problem with a project of mine, I want to rotate an planet on it's orbit around the sun to a certain degree that comes from an equation. I'm looking for a way to rotate a planet withount a need of doing 360 classes in CSS just to change them everytime. That degree is calculated from latitude and the angle of the planet's inclination, here's my code so far ``` function gorowanie(){ var wysokosc=document.getElementById("licz1").value; var nachylenie=document.getElementById("licz2").value; var polkola=document.getElementById("lista").value; var wynik=0; if(polkola=="1"){wynik=90-Number(wysokosc)+Number(nachylenie);} else if(polkola=="2"){wynik=90+Number(wysokosc)+Number(nachylenie);} else{wynik=90;} document.getElementById("linia").style.transform="rotate("+(Number(wynik)-90)+"deg)"; document.getElementById("wynik").innerHTML=wynik+"°"; } ``` If it helps I'll throw a photo of the project here (https://i.stack.imgur.com/puLKU.png) I was looking for something that can help me with that but sadly I just can't find anything that could help me, I was trying to use translate somehow but I just can't seem to get a good outcome. I would be thankfull if someone gave me an idea how to do it.
problem with edge server registration in Eureka
|java|spring|docker|kubernetes|spring-cloud|
null
How to create matrix in Stata
I am attempting to download data from the OECD. When I run this code: oecd.cpi.url <- list( core=list(dataset='MEI', indicator='CPGRLE01'), all.items=list(dataset='MEI', indicator='CPALTT01') ) gbp.cpi <- get_dataset(oecd.cpi.url$all.items$dataset, filter=list( LOCATION="GBR", INDICATOR=oecd.cpi.url$all.items$indicator )) This is the error I receive: <!-- language: lang-none --> Error in download.file(path, destfile, method, quiet, mode, ...) : cannot open URL 'https://stats.oecd.org/restsdmx/sdmx.ashx/GetData/MEI/all/all' Any help in resolving this would be greatly appreciated! I have tried various solutions and cannot seem to determine what is wrong.
I ran into a problem when I decided to make a server for microservices, but I ran into the problem that my microservice cannot register in Eureka, what could be wrong? ``` apiVersion: v1 kind: ConfigMap metadata: name: configmap data: foodcataloguedb_url: jdbc:postgresql://35.228.167.123:5432/foodcataloguedb orderdb_url: mongodb+srv://admin:219528Kirsing@atlas-cluster.st0oaiy.mongodb.net/ restaurantdb_url: jdbc:postgresql://35.228.167.123:5432/restaurantdb userdb_url: jdbc:postgresql://35.228.167.123:5432/userdb EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: "http://eureka:8761/eureka/" GATEWAY_APPLICATION_NAME: gateway ``` ``` apiVersion: apps/v1 kind: Deployment metadata: name: gateway labels: app: gateway spec: replicas: 1 selector: matchLabels: app: gateway template: metadata: labels: app: gateway spec: containers: - name: gateway image: kirsing123/gateway:v1.4 imagePullPolicy: Always ports: - containerPort: 8072 env: - name: SPRING_APPLICATION_NAME valueFrom: configMapKeyRef: name: configmap key: GATEWAY_APPLICATION_NAME - name: EUREKA_CLIENT_SERVICEURL_DEFAULTZONE valueFrom: configMapKeyRef: name: configmap key: EUREKA_CLIENT_SERVICEURL_DEFAULTZONE --- apiVersion: v1 kind: Service metadata: name: gateway spec: selector: app: gateway type: LoadBalancer ports: - protocol: TCP port: 8072 targetPort: 8072 ``` [Errors](https://i.stack.imgur.com/dElHe.png) [Eureka Dashboard](https://i.stack.imgur.com/uqnY8.png) I changed dependencies and turned the @EnableDiscoveryClient annotation on and off, to no avail