我有一个包含元素列表的数组:
description: [
'HTML & CSS',
'Responsive Design Fundamentals',
'Javascript object-oriented programming',
'jQuery',
'Website Performance Optimization',
'CRP and RAIL',
'REST API and Ajax',
'Javascript Design patterns',
'Bootsrap Framework',
'Polymer Web Elements'
],
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用模板字符串将此列表附加到HTML元素:
var description = [
'HTML & CSS',
'Javascript object-oriented programming',
'Progressive Web apps (PWAs)',
'Website Performance Optimization',
'Webpack and Gulp workflows',
'Fullstack React.js',
'Web Components',
'Responsive web design',
'Sketch design',
'GraphQL and Relay'
]
$('body').append(
`
<div class="description">
<ul>
${description.map(
function(work) {
return `<li>${work}</li>`
}
)}</ul>
</div> …Run Code Online (Sandbox Code Playgroud)javascript arrays ecmascript-6 template-literals array.prototype.map
我有一个问题将矩阵传递给C中的函数.有我想要创建的函数:
void ins (int *matrix, int row, int column);
Run Code Online (Sandbox Code Playgroud)
但我注意到与矢量相反,矩阵给我一个错误.如何将矩阵传递给函数呢?
编辑 - >有代码:
// Matrix
#include <stdio.h>
#define SIZE 100
void ins (int *matrix, int row, int column);
void print (int *matrix, int row, int column);
int main ()
{
int mat[SIZE][SIZE];
int row, col;
printf("Input rows: ");
scanf ("%d", &row);
printf("Input columns: ");
scanf ("%d", &col);
printf ("Input data: \n");
ins(mat, row, col);
printf ("You entered: ");
print(mat, row, col);
return 0;
}
void ins (int *matrix, int row, …Run Code Online (Sandbox Code Playgroud) 我必须在C中编写一个程序来读取包含几行文本的文件,每行包含两个变量:一个数字(%f)和一个字符串:
EX: file.txt
============
24.0 Torino
26.0 Milano
27.2 Milano
26.0 Torino
28.0 Torino
29.4 Milano
Run Code Online (Sandbox Code Playgroud)
有我的代码:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (int argc, char *argv[])
{
int r, line = 0, found = 0;
float temp, t_tot = 0;
char loc[32];
FILE *fp;
fp = fopen(argv[1], "r");
if (fp == NULL)
{
printf ("Error opening the file\n\n'");
exit(EXIT_FAILURE);
}
if (argc == 3)
{
r = fscanf(fp, "%f %s\n", &temp, loc);
while (r != EOF)
{ …Run Code Online (Sandbox Code Playgroud) 我正在使用React处理表组件,我遇到了一个大表集(> 500行)的问题.事实上,当我试图突出我点击的那一行时,我遇到了很大的性能泄漏.
为了实现行选择,我将保持一个状态,其中包含顶部组件中当前活动的行,该行包含表中所有行的容器.当我单击一个单元格时,我将使用单元格所属的行更新此状态.
这会导致render()方法触发我的顶级组件,并且由于重新渲染了大量元素,整个应用程序变得很慢.
如何仅重新渲染选定的行?是否有一般的最佳做法可以避免重新渲染顶级组件下的所有组件?
我用 C 语言编写了这个简单的程序,因为我现在正在大学学习文件。我获取了一个 txt 文件,其中包含上次比赛的结果列表,这样我的程序将显示我想要的格式化数据。这是我的代码:
/* Esercizio file Motogp */
#include <stdio.h>
#define SIZE 20
int main ()
{
int pos, punt, num;
float kmh;
char nome[SIZE+1], cognome[SIZE+1], moto[SIZE+1];
char naz[SIZE+1], nome_file[SIZE+1];
FILE *fp;
printf ("Inserisci il nome del file da aprire: ");
gets (nome_file);
fp = fopen (nome_file, "r");
if (fopen == NULL)
printf ("Errore nell' apertura del file %s\n", nome_file);
else {
while (fscanf (fp, "%d %d %d %s %s %s %s %.2f",
&pos, &punt, &num, nome, cognome, …Run Code Online (Sandbox Code Playgroud) 我有这个小程序:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define SIZE 30
void inverti (char s);
int main ()
{
char str[SIZE+1];
gets(str);
printf ("Your imput: ");
puts(str);
invert(*str);
printf ("It works!");
return 0;
}
void invert (char s)
{
int i;
for (i = 0; i < SIZE + 1; i++)
{
if (isupper(str[i]))
str[i] = tolower(str[i]);
else if (islower(str[i]))
str[i] = toupper(str[i]);
}
puts(str);
}
Run Code Online (Sandbox Code Playgroud)
那是错误吗?为什么我不能传递str给我的功能?
In function ‘main’:|
warning: passing argument 1 of ‘inverti’ makes integer from …Run Code Online (Sandbox Code Playgroud) 我需要做一个批处理,每天导出一个DB在"csv"文件中的数据.我正在使用SET COLSEP命令但是我有一些问题要导出一个大小为4000(VARCHAR2:4000)的大型化合物:它在输出文件中给我回复了很多空白行和换行符.
我会尝试用一个例子来更好地解释:
QUERY
-----
SET NEWPAGE 0
SET SPACE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET PAGESIZE 0
SET LINESIZE 2000
SET COLSEP ";"
SPOOL test.csv
SELECT
C.COLUMN1,
C.COLUMN2,
C.COLUMN3, -- column with issue
C.COLUMN4,
FROM TABLE1
WHERE CONDITION1 = TRUE;
SPOOL OFF
exit
Run Code Online (Sandbox Code Playgroud)
并且我的csv文件中有输出:
OUTPUT
------
+---------+---------+---------------------------+---------+
| COLUMN1 ; COLUMN2 ; COLUMN3 ; COLUMN4 |
+---------+---------+---------------------------+---------+
| VALUE1_1;VALUE1_2 ;Lorem ipsum dolor sit amet ;VALUE1_4 |
+---------+---------+---------------------------+---------+
| consectetur adipiscing elit |
+---------+---------+---------------------------+---------+
| …Run Code Online (Sandbox Code Playgroud) 根据样式组件doc,我可以引用另一个组件来触发,例如,悬停效果.
const Link = styled.a`
display: flex;
align-items: center;
padding: 5px 10px;
background: papayawhip;
color: palevioletred;
`;
const Link2 = styled.a`
display: flex;
align-items: center;
padding: 5px 10px;
background: steelblue;
color: white;
${Link}:hover & {
background-color: greenyellow;
color: black;
}
`;
class Hello extends React.Component{
render() {
return(
<div>
<Link>Hello World</Link>
<Link2>Hello Again</Link2>
</div>
)
}
}
Run Code Online (Sandbox Code Playgroud)
基本上,我的鼠标悬停<Link>应触发改变background-color的<Link2>.
这不会发生.有什么想法吗?
我在这里准备了一个代码片段:https://codesandbox.io/s/qv34lox494
我刚开始研究C中的函数,这阻止了我.我想编写一个函数来搜索元素向量中的SIZE元素.这是代码:
#include <stdio.h>
#define SIZE 10
int find(int vet[], int SIZE, int elem);
int main()
{
int vett[SIZE] = {1, 59, 16, 0, 7, 32, 78, 90, 83, 14};
int elem;
printf ("Imput the element to find: ");
scanf ("%d", &elem);
find(vett[SIZE], SIZE, elem);
if (find == 1)
printf ("\nI find the element!");
else if (find == 2)
printf ("\nI did not find the element!");
return 0;
}
int find(int vett[], int SIZE, int elem)
{
int i; …Run Code Online (Sandbox Code Playgroud) 我有以下SQL问题:
如何使用SELECT命令将一列(内部文本)分为两个单独的带有拆分文本的列?
我需要使用空格字符分隔文本数据。我知道最好举个例子来简化它。所以:
SELECT COLUMN_A FROM TABLE1
Run Code Online (Sandbox Code Playgroud)
输出:
COLUMN_A
-----------
LORE IPSUM
Run Code Online (Sandbox Code Playgroud)
所需的输出:
COLUMN_A COLUMN_B
--------- ----------
LORE IPSUM
Run Code Online (Sandbox Code Playgroud)
谢谢大家的帮助。
我想知道如何用C语言比较,我输入argv[2]的int数字和我的代码中的数字:
EX: prog.exe file.txt 74
========================
int n;
scanf ("%d", &n);
if (n > argv[2])
{
[...]
}
Run Code Online (Sandbox Code Playgroud)
如何比较这些不同类型的数据?