Support
Quality
Security
License
Reuse
kandi has reviewed smile and discovered the below as its top functions. This is intended to give you an instant insight into smile implemented functionality, and help decide if they suit your requirements.
Classification: Support Vector Machines, Decision Trees, AdaBoost, Gradient Boosting, Random Forest, Logistic Regression, Neural Networks, RBF Networks, Maximum Entropy Classifier, KNN, Naïve Bayesian, Fisher/Linear/Quadratic/Regularized Discriminant Analysis.
Regression: Support Vector Regression, Gaussian Process, Regression Trees, Gradient Boosting, Random Forest, RBF Networks, OLS, LASSO, ElasticNet, Ridge Regression.
Feature Selection: Genetic Algorithm based Feature Selection, Ensemble Learning based Feature Selection, TreeSHAP, Signal Noise ratio, Sum Squares ratio.
Clustering: BIRCH, CLARANS, DBSCAN, DENCLUE, Deterministic Annealing, K-Means, X-Means, G-Means, Neural Gas, Growing Neural Gas, Hierarchical Clustering, Sequential Information Bottleneck, Self-Organizing Maps, Spectral Clustering, Minimum Entropy Clustering.
Association Rule & Frequent Itemset Mining: FP-growth mining algorithm.
Manifold Learning: IsoMap, LLE, Laplacian Eigenmap, t-SNE, UMAP, PCA, Kernel PCA, Probabilistic PCA, GHA, Random Projection, ICA.
Multi-Dimensional Scaling: Classical MDS, Isotonic MDS, Sammon Mapping.
Nearest Neighbor Search: BK-Tree, Cover Tree, KD-Tree, SimHash, LSH.
Sequence Learning: Hidden Markov Model, Conditional Random Field.
Natural Language Processing: Sentence Splitter and Tokenizer, Bigram Statistical Test, Phrase Extractor, Keyword Extractor, Stemmer, POS Tagging, Relevance Ranking
Smile
<dependency>
<groupId>com.github.haifengl</groupId>
<artifactId>smile-core</artifactId>
<version>2.6.0</version>
</dependency>
Shell
./bin/smile
Visualization
<dependency>
<groupId>com.github.haifengl</groupId>
<artifactId>smile-plot</artifactId>
<version>2.6.0</version>
</dependency>
Distance column spacing with flex box (css)
.container {
display: flex;
}
.textarea {
height: 100px;
}
.sidebar {
display: flex;
justify-content: space-between;
flex-direction: column;
}
<div class="container">
<textarea class="textarea"></textarea>
<div class="sidebar">
<div class="smile">😅</div>
<div class="text">12</div>
</div>
</div>
-----------------------
.container {
display: flex;
}
.textarea {
height: 100px;
}
.sidebar {
display: flex;
justify-content: space-between;
flex-direction: column;
}
<div class="container">
<textarea class="textarea"></textarea>
<div class="sidebar">
<div class="smile">😅</div>
<div class="text">12</div>
</div>
</div>
-----------------------
<div class="btnGp">
<button #toggleEmojiTwitter class="emoji-button mt-2 mr-2" type="button" (click)="_isTwitterEmojiPickerVisible = !_isTwitterEmojiPickerVisible"><mdb-icon class="emoji-icon" far icon="smile"></mdb-icon></button>
<span class="text-count" [hidden]="_isTwitterEmojiPickerVisible">
<span>{{_twitterCharLimit - this._postsForm.get('twitterText').value.length}}</span>
</span>
</div>
.btnGp{
display : flex;
justify-content : space-between;
flex-direction : column;
height : 100%;
}
.emoji-text-container{
// a size of your choice
}
-----------------------
<div class="btnGp">
<button #toggleEmojiTwitter class="emoji-button mt-2 mr-2" type="button" (click)="_isTwitterEmojiPickerVisible = !_isTwitterEmojiPickerVisible"><mdb-icon class="emoji-icon" far icon="smile"></mdb-icon></button>
<span class="text-count" [hidden]="_isTwitterEmojiPickerVisible">
<span>{{_twitterCharLimit - this._postsForm.get('twitterText').value.length}}</span>
</span>
</div>
.btnGp{
display : flex;
justify-content : space-between;
flex-direction : column;
height : 100%;
}
.emoji-text-container{
// a size of your choice
}
-----------------------
.w {
border: 1px solid black;
display: flex;
min-height:200px;
}
.left {
width:100%;
border: 1px solid black;
}
.right {
width:70px;
}
.icons {
position:relative;
height:100%;
width:100%;
}
.top, .bottom {
position:absolute;
}
.top {
top:0;
}
.bottom {
bottom:0;
}
<div class="w">
<div class="left">1</div>
<div class="right">
<div class="icons">
<div class="top">top</div>
<div class="bottom">buttom</div>
</div>
</div>
</div>
.w {
border: 1px solid black;
display: flex;
min-height:200px;
}
.left {
width:100%;
border: 1px solid black;
}
.right {
width:70px;
}
.icons {
height:100%;
display: flex;
flex-direction: column;
justify-content: space-between;
background: gray;
flex-wrap: nowrap;
}
<div class="w">
<div class="left">1</div>
<div class="right">
<div class="icons">
<div class="top">top</div>
<div class="bottom">buttom</div>
</div>
</div>
</div>
-----------------------
.w {
border: 1px solid black;
display: flex;
min-height:200px;
}
.left {
width:100%;
border: 1px solid black;
}
.right {
width:70px;
}
.icons {
position:relative;
height:100%;
width:100%;
}
.top, .bottom {
position:absolute;
}
.top {
top:0;
}
.bottom {
bottom:0;
}
<div class="w">
<div class="left">1</div>
<div class="right">
<div class="icons">
<div class="top">top</div>
<div class="bottom">buttom</div>
</div>
</div>
</div>
.w {
border: 1px solid black;
display: flex;
min-height:200px;
}
.left {
width:100%;
border: 1px solid black;
}
.right {
width:70px;
}
.icons {
height:100%;
display: flex;
flex-direction: column;
justify-content: space-between;
background: gray;
flex-wrap: nowrap;
}
<div class="w">
<div class="left">1</div>
<div class="right">
<div class="icons">
<div class="top">top</div>
<div class="bottom">buttom</div>
</div>
</div>
</div>
-----------------------
.w {
border: 1px solid black;
display: flex;
min-height:200px;
}
.left {
width:100%;
border: 1px solid black;
}
.right {
width:70px;
}
.icons {
position:relative;
height:100%;
width:100%;
}
.top, .bottom {
position:absolute;
}
.top {
top:0;
}
.bottom {
bottom:0;
}
<div class="w">
<div class="left">1</div>
<div class="right">
<div class="icons">
<div class="top">top</div>
<div class="bottom">buttom</div>
</div>
</div>
</div>
.w {
border: 1px solid black;
display: flex;
min-height:200px;
}
.left {
width:100%;
border: 1px solid black;
}
.right {
width:70px;
}
.icons {
height:100%;
display: flex;
flex-direction: column;
justify-content: space-between;
background: gray;
flex-wrap: nowrap;
}
<div class="w">
<div class="left">1</div>
<div class="right">
<div class="icons">
<div class="top">top</div>
<div class="bottom">buttom</div>
</div>
</div>
</div>
-----------------------
.w {
border: 1px solid black;
display: flex;
min-height:200px;
}
.left {
width:100%;
border: 1px solid black;
}
.right {
width:70px;
}
.icons {
position:relative;
height:100%;
width:100%;
}
.top, .bottom {
position:absolute;
}
.top {
top:0;
}
.bottom {
bottom:0;
}
<div class="w">
<div class="left">1</div>
<div class="right">
<div class="icons">
<div class="top">top</div>
<div class="bottom">buttom</div>
</div>
</div>
</div>
.w {
border: 1px solid black;
display: flex;
min-height:200px;
}
.left {
width:100%;
border: 1px solid black;
}
.right {
width:70px;
}
.icons {
height:100%;
display: flex;
flex-direction: column;
justify-content: space-between;
background: gray;
flex-wrap: nowrap;
}
<div class="w">
<div class="left">1</div>
<div class="right">
<div class="icons">
<div class="top">top</div>
<div class="bottom">buttom</div>
</div>
</div>
</div>
How can i fix Task was destroyed but it is pending?
await mycursor.execute("SELECT * FROM guild_message_count WHERE guild_id = %s AND user_id = %s", (message.author.guild.id, message.author.id))
in_database2 = await mycursor.fetchone()
if in_database2:
await mycursor.execute("UPDATE guild_message_count SET user_id = %s, message_count = message_count + %s WHERE guild_id = %s AND user_id = %s", (message.author.id, count, message.author.guild.id, message.author.id))
else:
await mycursor.execute("INSERT INTO guild_message_count (user_id, message_count, guild_id) VALUES (%s, %s, %s)", (message.author.id, count, message.author.guild.id))
INSERT INTO guild_message_count
(user_id, message_count, guild_id)
VALUES
(%s, %s, %s)
ON DUPLICATE KEY UPDATE
message_count = message_count + 1
-----------------------
await mycursor.execute("SELECT * FROM guild_message_count WHERE guild_id = %s AND user_id = %s", (message.author.guild.id, message.author.id))
in_database2 = await mycursor.fetchone()
if in_database2:
await mycursor.execute("UPDATE guild_message_count SET user_id = %s, message_count = message_count + %s WHERE guild_id = %s AND user_id = %s", (message.author.id, count, message.author.guild.id, message.author.id))
else:
await mycursor.execute("INSERT INTO guild_message_count (user_id, message_count, guild_id) VALUES (%s, %s, %s)", (message.author.id, count, message.author.guild.id))
INSERT INTO guild_message_count
(user_id, message_count, guild_id)
VALUES
(%s, %s, %s)
ON DUPLICATE KEY UPDATE
message_count = message_count + 1
-----------------------
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
loop.close()
sleeping for 1 second(s)
sleeping for 2 second(s)
done sleeping for 1 second(s)
Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<delay() running at aio.py:10> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa794c5b970>()]>
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
pending = asyncio.all_tasks(loop=loop)
group = asyncio.gather(*pending)
loop.run_until_complete(group)
loop.close()
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
async def main():
t1 = asyncio.create_task(delay(1))
t2 = asyncio.create_task(delay(2))
await t2
asyncio.run(main())
import asyncio
asyncio.run(client.start('token'))
-----------------------
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
loop.close()
sleeping for 1 second(s)
sleeping for 2 second(s)
done sleeping for 1 second(s)
Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<delay() running at aio.py:10> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa794c5b970>()]>
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
pending = asyncio.all_tasks(loop=loop)
group = asyncio.gather(*pending)
loop.run_until_complete(group)
loop.close()
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
async def main():
t1 = asyncio.create_task(delay(1))
t2 = asyncio.create_task(delay(2))
await t2
asyncio.run(main())
import asyncio
asyncio.run(client.start('token'))
-----------------------
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
loop.close()
sleeping for 1 second(s)
sleeping for 2 second(s)
done sleeping for 1 second(s)
Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<delay() running at aio.py:10> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa794c5b970>()]>
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
pending = asyncio.all_tasks(loop=loop)
group = asyncio.gather(*pending)
loop.run_until_complete(group)
loop.close()
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
async def main():
t1 = asyncio.create_task(delay(1))
t2 = asyncio.create_task(delay(2))
await t2
asyncio.run(main())
import asyncio
asyncio.run(client.start('token'))
-----------------------
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
loop.close()
sleeping for 1 second(s)
sleeping for 2 second(s)
done sleeping for 1 second(s)
Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<delay() running at aio.py:10> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa794c5b970>()]>
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
pending = asyncio.all_tasks(loop=loop)
group = asyncio.gather(*pending)
loop.run_until_complete(group)
loop.close()
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
async def main():
t1 = asyncio.create_task(delay(1))
t2 = asyncio.create_task(delay(2))
await t2
asyncio.run(main())
import asyncio
asyncio.run(client.start('token'))
-----------------------
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
loop.close()
sleeping for 1 second(s)
sleeping for 2 second(s)
done sleeping for 1 second(s)
Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<delay() running at aio.py:10> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa794c5b970>()]>
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
loop = asyncio.get_event_loop()
t1 = loop.create_task(delay(1))
t2 = loop.create_task(delay(2))
loop.run_until_complete(t1)
pending = asyncio.all_tasks(loop=loop)
group = asyncio.gather(*pending)
loop.run_until_complete(group)
loop.close()
import asyncio
async def delay(n):
print(f"sleeping for {n} second(s)")
await asyncio.sleep(n)
print(f"done sleeping for {n} second(s)")
async def main():
t1 = asyncio.create_task(delay(1))
t2 = asyncio.create_task(delay(2))
await t2
asyncio.run(main())
import asyncio
asyncio.run(client.start('token'))
-----------------------
async def _check_channel(self, message, pool):
async with pool.acquire() as conn:
async with conn.cursor() as cursor:
await cursor.execute(
"SELECT ignore_channel_id FROM guild_channel_settings WHERE guild_id = %s",
(message.author.guild.id,),
)
in_database = await cursor.fetchone()
if in_database and in_database[0] is not None:
channel_list = in_database[0].split(" ")
for channelid in channel_list:
try:
channel_id_int = int(channelid)
except ValueError:
continue
if int(message.channel.id) == channel_id_int:
return False
async def _get_role_count(self, message, pool):
async with pool.acquire() as conn:
async with conn.cursor() as cursor:
await cursor.execute(
"SELECT ignore_role_id, bonus_role_id FROM guild_role_settings WHERE guild_id = %s",
(message.author.guild.id,),
)
in_database = await cursor.fetchone()
if in_database:
first_item, second_item, *_ = in_database
if first_item is not None:
role_list = first_item.split(" ")
for roleid in role_list:
try:
roleid_int = int(roleid)
except ValueError:
continue
role = message.author.guild.get_role(roleid_int)
if role is None:
continue
if role in message.author.roles:
return False
if second_item is not None:
role_list = second_item.split(" ")
count = 0
for roleid in role_list:
try:
roleid_int = int(roleid)
except ValueError:
continue
role = message.author.guild.get_role(roleid_int)
if role is None:
continue
if role in message.author.roles:
count += 1
return count
@commands.Cog.listener("on_message")
async def on_message(self, message):
if message.author.bot:
return
if message.type != discord.MessageType.default:
return
if isinstance(message.channel, discord.channel.DMChannel):
return
# Cooldown
self.member_cooldown_list = [
i
for i in self.member_cooldown_list
if i[1] + self.cooldown_val > int(time.time())
]
member_index = next(
(
i
for i, v in enumerate(self.member_cooldown_list)
if v[0] == message.author.id
),
None,
)
if member_index is not None:
if self.member_cooldown_list[member_index][1] + self.cooldown_val > int(
time.time()
):
return
self.member_cooldown_list.append((message.author.id, int(time.time())))
loop = asyncio.get_running_loop()
db_pool = await aiomysql.create_pool(
minsize=3,
host="<host>",
port=3306,
user="<user>",
password="<password>",
db="<db_name>",
autocommit=False,
loop=loop,
)
count = 1
check_channel_task = asyncio.create_task(
self._check_channel(self, message, db_pool)
)
role_count_task = asyncio.create_task(self._get_role_count(self, message, db_pool))
# write to database
mydb = await db_pool.acquire()
mycursor = await mydb.cursor()
await mycursor.execute(
"SELECT * FROM guild_message_count WHERE guild_id = %s AND user_id = %s",
(message.author.guild.id, message.author.id),
)
in_database = await mycursor.fetchone()
role_count = await role_count_task
if False in (role_count, await check_channel_task):
await mycursor.close()
db_pool.release(mydb)
db_pool.close()
await db_pool.wait_closed()
return
if role_count:
count += role_count
if in_database:
await mycursor.execute(
"INSERT INTO guild_message_count (user_id, message_count, guild_id) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE message_count = message_count + 1",
(message.author.id, count, message.author.guild.id),
)
await mydb.commit()
await mycursor.close()
db_pool.release(mydb)
db_pool.close()
await db_pool.wait_closed()
material-ui horizontally align two cards below first card
export default function GraphBackDrop() {
return (
<Container>
<Grid
container
spacing={3}
justifyContent="center"
alignItems="stretch"
>
<Grid item xs={12}>
<YourCardOne />
</Grid>
<Grid item xs={12} sm={6}>
<YourCardTwo />
</Grid>
<Grid item xs={12} sm={6}>
<YourCardThree />
</Grid>
</Grid>
</Container>
);
}
how change AOS animate z-index?
[data-aos] {
pointer-events: none;
}
.aos-animate {
pointer-events: auto;
}
.aos-init[data-aos][data-aos].aos-animate {
transform: unset;
}
How do I map a dictionary onto a dataframe column without including the header?
dictionary = smiles_df.set_index('ID')['SMILES'].to_dict()
dictionary = dict(zip(smiles_df['ID'], smiles_df['SMILES']))
-----------------------
dictionary = smiles_df.set_index('ID')['SMILES'].to_dict()
dictionary = dict(zip(smiles_df['ID'], smiles_df['SMILES']))
Add new column in dataframe based on multiple column conditions
conditions = [df['Positive']>=0.80, df['Negative']>=0.80, ((df['Positive']>=0.50) & (df['Positive']<0.80)),
((df['Negative']>=0.50) & (df['Negative']<0.80)), df['Neutral']>=0.5]
values = ['Very Positive', 'Very Negative', 'Positive', 'Negative', 'Neutral']
df['Sentiment'] = np.select(conditions, values, default=np.nan)
Text Negative Neutral Positive Sentiment
0 I lost my phone. I am sad 0.80 0.15 0.05 Very Negative
1 How is your day? 0.10 0.80 0.10 Neutral
2 Let's go out for dinner today. 0.06 0.55 0.39 Neutral
3 I am super pissed at my friend for cancelling ... 0.73 0.11 0.16 Negative
4 I am so happy I want to dance 0.00 0.10 0.90 Very Positive
5 I am not sure if I should laugh or just smile 0.08 0.24 0.68 Positive
-----------------------
conditions = [df['Positive']>=0.80, df['Negative']>=0.80, ((df['Positive']>=0.50) & (df['Positive']<0.80)),
((df['Negative']>=0.50) & (df['Negative']<0.80)), df['Neutral']>=0.5]
values = ['Very Positive', 'Very Negative', 'Positive', 'Negative', 'Neutral']
df['Sentiment'] = np.select(conditions, values, default=np.nan)
Text Negative Neutral Positive Sentiment
0 I lost my phone. I am sad 0.80 0.15 0.05 Very Negative
1 How is your day? 0.10 0.80 0.10 Neutral
2 Let's go out for dinner today. 0.06 0.55 0.39 Neutral
3 I am super pissed at my friend for cancelling ... 0.73 0.11 0.16 Negative
4 I am so happy I want to dance 0.00 0.10 0.90 Very Positive
5 I am not sure if I should laugh or just smile 0.08 0.24 0.68 Positive
-----------------------
def your_fn(values):
pos = values["Positive"]
neu = values["Neutral"]
neg = values["Negative"]
# 1. If the value of negative or positive is most dominating and >= 0.8 (80%) then mark it as very negative or very positive.
if (pos >= .8):
return "Very positive"
if (neg >= .8):
return "Very negative"
# 2. If the value of negative or positive is most dominating but it is >= 0.5 but less than 0.8 then just negative or positive.
if (pos >= .5):
return "Positive"
if (neg >= .5):
return "Negative"
# 3. If the value of neutral is >= 0.5 then Neutral. There is no such thing as Very Neutral.
if (neu >= .5):
return "Neutral"
return "-"
df['Sentiment'] = df.apply(your_fn, axis=1)
-----------------------
s = df.drop('Text', axis=1).idxmax(1)
m = df.drop('Text', axis=1).max(1)
df['Sentiment'] = np.where(m.ge(0.8)&s.ne('Neutral'), 'Very '+s, s)
Text Negative Neutral Positive Sentiment
0 I lost my phone. I am sad 0.80 0.15 0.05 Very Negative
1 How is your day? 0.10 0.80 0.10 Neutral
2 Let's go out for dinner today. 0.06 0.55 0.39 Neutral
3 I am super pissed at my friend for cancelling the party. 0.73 0.11 0.16 Negative
4 I am so happy I want to dance 0.00 0.10 0.90 Very Positive
5 I am not sure if I should laugh or just smile 0.08 0.24 0.68 Positive
-----------------------
s = df.drop('Text', axis=1).idxmax(1)
m = df.drop('Text', axis=1).max(1)
df['Sentiment'] = np.where(m.ge(0.8)&s.ne('Neutral'), 'Very '+s, s)
Text Negative Neutral Positive Sentiment
0 I lost my phone. I am sad 0.80 0.15 0.05 Very Negative
1 How is your day? 0.10 0.80 0.10 Neutral
2 Let's go out for dinner today. 0.06 0.55 0.39 Neutral
3 I am super pissed at my friend for cancelling the party. 0.73 0.11 0.16 Negative
4 I am so happy I want to dance 0.00 0.10 0.90 Very Positive
5 I am not sure if I should laugh or just smile 0.08 0.24 0.68 Positive
Image view size not respected in JavaFX tab pane dropdown
@Override
public void start(Stage primaryStage) throws Exception {
TabPane pane = new TabPane();
ImageView image = new ImageView(new Image(new FileInputStream("smile.jpg"),
TAB_IMAGE_SIZE, TAB_IMAGE_SIZE, true, true));
// image.setFitHeight(TAB_IMAGE_SIZE);
// image.setFitWidth(TAB_IMAGE_SIZE);
Tab imageTab = new Tab();
imageTab.setGraphic(image);
pane.getTabs().add(imageTab);
for(int i = 0; i < 10; i++) {
pane.getTabs().add(new Tab("Tab " + i));
}
primaryStage.setScene(new Scene(pane, 300, 300));
primaryStage.show();
}
RDKit: "TypeError: 'Mol' object is not iterable" when attempting looped enumeration
import os
import csv
os.chdir('xxx')
from rdkit import Chem
from rdkit.Chem import rdChemReactions
from rdkit.Chem import AllChem
rxn = rdChemReactions.ReactionFromSmarts('xxx')
rct1 = Chem.SDMolSupplier('reactants_1.sdf')
rct2 = Chem.SDMolSupplier('reactants_2.sdf')
with open('output.csv', 'w', newline='') as f:
for compound in rct1:
compound = [compound] # put the mol into a list
prods = AllChem.EnumerateLibraryFromReaction(rxn,[compound,rct2])
prods2 = [Chem.MolToSmiles(x[0]) for x in list(prods)]
writer = csv.writer(f)
for item in prods2:
writer.writerow([item])
Subclassing UIView from Kotlin Native
kotlin {
android()
ios {
binaries {
framework {
baseName = "shared"
}
}
compilations.getByName("main") {
val uikit by cinterops.creating {
}
}
}
package = demo.cinterop
language = Objective-C
---
#import <Foundation/Foundation.h>
#import <UIKit/UIView.h>
@protocol UIViewWithOverrides
- (void) drawRect:(CGRect)aRect;
- (void) layoutSubviews;
@end
package demo
import demo.cinterop.UIViewWithOverridesProtocol
import kotlinx.cinterop.*
import platform.CoreGraphics.*
import platform.UIKit.*
@ExportObjCClass
class MyView() : UIView(frame = CGRectMake(.0, .0, .0, .0)), UIViewWithOverridesProtocol {
override fun layoutSubviews() {
println("layoutSubviews")
setNeedsDisplay()
}
override fun drawRect(aRect: CValue<CGRect>) {
val rectAsString = aRect.useContents {
"" + this.origin.x + ", " + this.origin.y + ", " + (this.origin.x +this.size.width) + ", " + (this.origin.y +this.size.height)
}
println("drawRect:: Rect[$rectAsString]")
val context: CPointer<CGContext>? = UIGraphicsGetCurrentContext()
CGContextSetLineWidth(context, 2.0)
val components = cValuesOf(0.0, 0.0, 1.0, 1.0)
CGContextSetFillColor(context, components)
val square = CGRectMake(100.0, 100.0, 200.0, 200.0)
CGContextFillRect(context, square)
}
}
fun createMyView(): UIView = MyView()
struct ChartView: View {
var body: some View {
VStack {
Text("Chart View")
MyView()
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
}
}
}
struct ChartView_Previews: PreviewProvider {
static var previews: some View {
ChartView()
}
}
struct MyView: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
UIChartViewKt.createMyView()
}
func updateUIView(_ uiView: UIView, context: Context) {
}
}
-----------------------
kotlin {
android()
ios {
binaries {
framework {
baseName = "shared"
}
}
compilations.getByName("main") {
val uikit by cinterops.creating {
}
}
}
package = demo.cinterop
language = Objective-C
---
#import <Foundation/Foundation.h>
#import <UIKit/UIView.h>
@protocol UIViewWithOverrides
- (void) drawRect:(CGRect)aRect;
- (void) layoutSubviews;
@end
package demo
import demo.cinterop.UIViewWithOverridesProtocol
import kotlinx.cinterop.*
import platform.CoreGraphics.*
import platform.UIKit.*
@ExportObjCClass
class MyView() : UIView(frame = CGRectMake(.0, .0, .0, .0)), UIViewWithOverridesProtocol {
override fun layoutSubviews() {
println("layoutSubviews")
setNeedsDisplay()
}
override fun drawRect(aRect: CValue<CGRect>) {
val rectAsString = aRect.useContents {
"" + this.origin.x + ", " + this.origin.y + ", " + (this.origin.x +this.size.width) + ", " + (this.origin.y +this.size.height)
}
println("drawRect:: Rect[$rectAsString]")
val context: CPointer<CGContext>? = UIGraphicsGetCurrentContext()
CGContextSetLineWidth(context, 2.0)
val components = cValuesOf(0.0, 0.0, 1.0, 1.0)
CGContextSetFillColor(context, components)
val square = CGRectMake(100.0, 100.0, 200.0, 200.0)
CGContextFillRect(context, square)
}
}
fun createMyView(): UIView = MyView()
struct ChartView: View {
var body: some View {
VStack {
Text("Chart View")
MyView()
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
}
}
}
struct ChartView_Previews: PreviewProvider {
static var previews: some View {
ChartView()
}
}
struct MyView: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
UIChartViewKt.createMyView()
}
func updateUIView(_ uiView: UIView, context: Context) {
}
}
-----------------------
kotlin {
android()
ios {
binaries {
framework {
baseName = "shared"
}
}
compilations.getByName("main") {
val uikit by cinterops.creating {
}
}
}
package = demo.cinterop
language = Objective-C
---
#import <Foundation/Foundation.h>
#import <UIKit/UIView.h>
@protocol UIViewWithOverrides
- (void) drawRect:(CGRect)aRect;
- (void) layoutSubviews;
@end
package demo
import demo.cinterop.UIViewWithOverridesProtocol
import kotlinx.cinterop.*
import platform.CoreGraphics.*
import platform.UIKit.*
@ExportObjCClass
class MyView() : UIView(frame = CGRectMake(.0, .0, .0, .0)), UIViewWithOverridesProtocol {
override fun layoutSubviews() {
println("layoutSubviews")
setNeedsDisplay()
}
override fun drawRect(aRect: CValue<CGRect>) {
val rectAsString = aRect.useContents {
"" + this.origin.x + ", " + this.origin.y + ", " + (this.origin.x +this.size.width) + ", " + (this.origin.y +this.size.height)
}
println("drawRect:: Rect[$rectAsString]")
val context: CPointer<CGContext>? = UIGraphicsGetCurrentContext()
CGContextSetLineWidth(context, 2.0)
val components = cValuesOf(0.0, 0.0, 1.0, 1.0)
CGContextSetFillColor(context, components)
val square = CGRectMake(100.0, 100.0, 200.0, 200.0)
CGContextFillRect(context, square)
}
}
fun createMyView(): UIView = MyView()
struct ChartView: View {
var body: some View {
VStack {
Text("Chart View")
MyView()
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
}
}
}
struct ChartView_Previews: PreviewProvider {
static var previews: some View {
ChartView()
}
}
struct MyView: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
UIChartViewKt.createMyView()
}
func updateUIView(_ uiView: UIView, context: Context) {
}
}
-----------------------
kotlin {
android()
ios {
binaries {
framework {
baseName = "shared"
}
}
compilations.getByName("main") {
val uikit by cinterops.creating {
}
}
}
package = demo.cinterop
language = Objective-C
---
#import <Foundation/Foundation.h>
#import <UIKit/UIView.h>
@protocol UIViewWithOverrides
- (void) drawRect:(CGRect)aRect;
- (void) layoutSubviews;
@end
package demo
import demo.cinterop.UIViewWithOverridesProtocol
import kotlinx.cinterop.*
import platform.CoreGraphics.*
import platform.UIKit.*
@ExportObjCClass
class MyView() : UIView(frame = CGRectMake(.0, .0, .0, .0)), UIViewWithOverridesProtocol {
override fun layoutSubviews() {
println("layoutSubviews")
setNeedsDisplay()
}
override fun drawRect(aRect: CValue<CGRect>) {
val rectAsString = aRect.useContents {
"" + this.origin.x + ", " + this.origin.y + ", " + (this.origin.x +this.size.width) + ", " + (this.origin.y +this.size.height)
}
println("drawRect:: Rect[$rectAsString]")
val context: CPointer<CGContext>? = UIGraphicsGetCurrentContext()
CGContextSetLineWidth(context, 2.0)
val components = cValuesOf(0.0, 0.0, 1.0, 1.0)
CGContextSetFillColor(context, components)
val square = CGRectMake(100.0, 100.0, 200.0, 200.0)
CGContextFillRect(context, square)
}
}
fun createMyView(): UIView = MyView()
struct ChartView: View {
var body: some View {
VStack {
Text("Chart View")
MyView()
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
}
}
}
struct ChartView_Previews: PreviewProvider {
static var previews: some View {
ChartView()
}
}
struct MyView: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
UIChartViewKt.createMyView()
}
func updateUIView(_ uiView: UIView, context: Context) {
}
}
-----------------------
class CustomView : UIView {
/* Data we need to use from the Kotlin Code */
lazy var kotlinClass: KotlinClass? = nil
... init etc. ...
override func updateConstraints() {
... my stuff ...
super.updateConstraints()
}
override func draw(_ rect: CGRect) {
... call the kotlinClass' methods as you need ...
}
}
func customViewFactory(kotlinClass: KotlinClass) -> UIView {
return CustomView(kotlinClass: kotlinClass)
}
KotlinClass.Companion.shared.setCustomViewFactory(factory: customViewFactory(kotlinClass:))
class KotlinClass {
companion object {
/* To be used where I want to instantiate the custom UIView from the Kotlin code. */
lateinit var customViewFactory: (kotlinClass: KotlinClass) -> UIView
/* To be used early during the startup of the app from the Swift code. */
fun setCustomViewFactory(factory: (kotlinClass: KotlinClass) -> UIView) {
customViewFactory = factory
}
}
val customView = customViewFactory(this)
-----------------------
class CustomView : UIView {
/* Data we need to use from the Kotlin Code */
lazy var kotlinClass: KotlinClass? = nil
... init etc. ...
override func updateConstraints() {
... my stuff ...
super.updateConstraints()
}
override func draw(_ rect: CGRect) {
... call the kotlinClass' methods as you need ...
}
}
func customViewFactory(kotlinClass: KotlinClass) -> UIView {
return CustomView(kotlinClass: kotlinClass)
}
KotlinClass.Companion.shared.setCustomViewFactory(factory: customViewFactory(kotlinClass:))
class KotlinClass {
companion object {
/* To be used where I want to instantiate the custom UIView from the Kotlin code. */
lateinit var customViewFactory: (kotlinClass: KotlinClass) -> UIView
/* To be used early during the startup of the app from the Swift code. */
fun setCustomViewFactory(factory: (kotlinClass: KotlinClass) -> UIView) {
customViewFactory = factory
}
}
val customView = customViewFactory(this)
-----------------------
class CustomView : UIView {
/* Data we need to use from the Kotlin Code */
lazy var kotlinClass: KotlinClass? = nil
... init etc. ...
override func updateConstraints() {
... my stuff ...
super.updateConstraints()
}
override func draw(_ rect: CGRect) {
... call the kotlinClass' methods as you need ...
}
}
func customViewFactory(kotlinClass: KotlinClass) -> UIView {
return CustomView(kotlinClass: kotlinClass)
}
KotlinClass.Companion.shared.setCustomViewFactory(factory: customViewFactory(kotlinClass:))
class KotlinClass {
companion object {
/* To be used where I want to instantiate the custom UIView from the Kotlin code. */
lateinit var customViewFactory: (kotlinClass: KotlinClass) -> UIView
/* To be used early during the startup of the app from the Swift code. */
fun setCustomViewFactory(factory: (kotlinClass: KotlinClass) -> UIView) {
customViewFactory = factory
}
}
val customView = customViewFactory(this)
-----------------------
class CustomView : UIView {
/* Data we need to use from the Kotlin Code */
lazy var kotlinClass: KotlinClass? = nil
... init etc. ...
override func updateConstraints() {
... my stuff ...
super.updateConstraints()
}
override func draw(_ rect: CGRect) {
... call the kotlinClass' methods as you need ...
}
}
func customViewFactory(kotlinClass: KotlinClass) -> UIView {
return CustomView(kotlinClass: kotlinClass)
}
KotlinClass.Companion.shared.setCustomViewFactory(factory: customViewFactory(kotlinClass:))
class KotlinClass {
companion object {
/* To be used where I want to instantiate the custom UIView from the Kotlin code. */
lateinit var customViewFactory: (kotlinClass: KotlinClass) -> UIView
/* To be used early during the startup of the app from the Swift code. */
fun setCustomViewFactory(factory: (kotlinClass: KotlinClass) -> UIView) {
customViewFactory = factory
}
}
val customView = customViewFactory(this)
-----------------------
class CustomView : UIView {
/* Data we need to use from the Kotlin Code */
lazy var kotlinClass: KotlinClass? = nil
... init etc. ...
override func updateConstraints() {
... my stuff ...
super.updateConstraints()
}
override func draw(_ rect: CGRect) {
... call the kotlinClass' methods as you need ...
}
}
func customViewFactory(kotlinClass: KotlinClass) -> UIView {
return CustomView(kotlinClass: kotlinClass)
}
KotlinClass.Companion.shared.setCustomViewFactory(factory: customViewFactory(kotlinClass:))
class KotlinClass {
companion object {
/* To be used where I want to instantiate the custom UIView from the Kotlin code. */
lateinit var customViewFactory: (kotlinClass: KotlinClass) -> UIView
/* To be used early during the startup of the app from the Swift code. */
fun setCustomViewFactory(factory: (kotlinClass: KotlinClass) -> UIView) {
customViewFactory = factory
}
}
val customView = customViewFactory(this)
Reorganizing and collapsing many csv's in R
names2use <- list.files(path2direcitonwherefilesare)
fileList <- lapply(names2use, function(x) { read.csv(file.path(path2direcitonwherefilesare, x), ...)
#my dummy data set
un01 <- data.frame(types=c("mean", "sd"), hill=c(0.1,0.2), boat=c(0.1,0.2))
un02 <- data.frame(types=c("mean", "sd"), trip=c(0.1,0.2), clip=c(0.1,0.2))
jp01 <- data.frame(types=c("mean", "sd"), hill=c(0.1,0.2), boat=c(0.1,0.2))
fileList <- list(un01, un02, jp01)
filenames <- c("un01", "un02", "jp01")
types <- unique(substr(filenames, start = 1, stop = 2))
infos <- as.character(un01[,1])
names2use <- c(paste(types, sort(rep(infos, length(types))), sep="_"))
rows <- unique(unlist(lapply(fileList, function(x) {names(x)})))[-1]
#creating empty an data.frame
data <- as.data.frame(matrix(NA, nrow=length(cols), ncol=length(names2use)+1))
data[,1] <- rows
names(data) <- c("word", sort(names2use))
i <- 1
for (file in fileList) {
filename <- substr(filenames[[i]],1,2)
for (n in 2:length(names(file))) {
data[data$word==names(file)[n], substr(names(data),1,2) %in% filename] <- file[[names(file)[n]]]
}
i <- i + 1
}
> data
word jp_mean jp_sd un_mean un_sd
1 hill 0.1 0.2 0.1 0.2
2 boat 0.1 0.2 0.1 0.2
3 trip NA NA 0.1 0.2
4 clip NA NA 0.1 0.2
-----------------------
names2use <- list.files(path2direcitonwherefilesare)
fileList <- lapply(names2use, function(x) { read.csv(file.path(path2direcitonwherefilesare, x), ...)
#my dummy data set
un01 <- data.frame(types=c("mean", "sd"), hill=c(0.1,0.2), boat=c(0.1,0.2))
un02 <- data.frame(types=c("mean", "sd"), trip=c(0.1,0.2), clip=c(0.1,0.2))
jp01 <- data.frame(types=c("mean", "sd"), hill=c(0.1,0.2), boat=c(0.1,0.2))
fileList <- list(un01, un02, jp01)
filenames <- c("un01", "un02", "jp01")
types <- unique(substr(filenames, start = 1, stop = 2))
infos <- as.character(un01[,1])
names2use <- c(paste(types, sort(rep(infos, length(types))), sep="_"))
rows <- unique(unlist(lapply(fileList, function(x) {names(x)})))[-1]
#creating empty an data.frame
data <- as.data.frame(matrix(NA, nrow=length(cols), ncol=length(names2use)+1))
data[,1] <- rows
names(data) <- c("word", sort(names2use))
i <- 1
for (file in fileList) {
filename <- substr(filenames[[i]],1,2)
for (n in 2:length(names(file))) {
data[data$word==names(file)[n], substr(names(data),1,2) %in% filename] <- file[[names(file)[n]]]
}
i <- i + 1
}
> data
word jp_mean jp_sd un_mean un_sd
1 hill 0.1 0.2 0.1 0.2
2 boat 0.1 0.2 0.1 0.2
3 trip NA NA 0.1 0.2
4 clip NA NA 0.1 0.2
-----------------------
# Use the tidyverse.
library(tidyverse)
# Function to transform CSVs into a standard form.
standardize_csv <- function(csv_data, csv_prefix){
# Turn the word columns into a single column.
csv_data %>% pivot_longer(
# The word columns are every column except the 1st, which names the metric.
cols = !1,
names_to = "word"
) %>%
# Include the CSV prefix for reference.
mutate(
csv_prefix = csv_prefix
) %>%
# Rename and reformat the dataset.
select(
csv_prefix,
word,
metric = 1,
value
)
}
# Find all CSV variables named by your convention, within your workspace.
csv_list <- sapply(
X = ls(pattern = "^[a-z]{2,2}0[1-5]$"),
FUN = get,
simplify = FALSE,
USE.NAMES = TRUE
)
# Consolidate into the final form:
final_df <- csv_list %>%
mapply(
# Transform into standard form...
FUN = standardize_csv,
# ...the CSV datasets...
csv_data = .,
# ...with their prefixes.
csv_prefix = gsub(
x = names(.),
pattern = "^([a-z]*)(\\d*)$",
replacement = "\\1"
),
SIMPLIFY = FALSE
) %>%
# Stack those standardized datasets into a single table.
do.call(
what = bind_rows
) %>%
# Pivot the table to have one column for each family and metric ('un_mean',
# 'pm_SD', etc.).
pivot_wider(
names_from = c(csv_prefix, metric),
names_glue = "{csv_prefix}_{metric}",
values_from = value
)
# View the result.
final_df
un01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(2.26315789473684, 38, 2.0623289187203),
user = c(1.13157894736842, 38, 1.57978877533674),
name = c(2.42105263157895, 38, 1.96773403700762),
paint = c(4.18421052631579, 38, 1.81369062527503),
smile = c(6.05263157894737, 38, 1.98572430003074),
back = c(4.10526315789474, 38, 2.0767629916461),
mouse = c(7.35135135135135, 38, 1.75144727798686),
potato = c(5.94736842105263, 38, 2.01276156159657),
pain = c(1.34210526315789, 38, 1.69699759972873),
life = c(4.05263157894737, 38, 1.99928863593695)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
un05 <- structure(
list(
...1 = c("mean", "n", "SD"),
house = c(5.08823529411765, 34, 1.65817802638964),
person = c(4.11764705882353, 34, 2.15694376772143),
city = c(2.47058823529412, 34, 1.70978102651927),
agressive = c(5, 34, 1.95401684183679)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
pm01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(5.3030303030303, 33, 1.64857606142484),
user = c(4.24242424242424, 33, 1.96898297082375),
name = c(7.18181818181818, 33, 1.18465568453838),
paint = c(3.27272727272727, 33, 1.71887912738082),
smile = c(1.15151515151515, 33, 4.8728523053289),
back = c(4.3030303030303, 33, 2.02306772756204),
mouse = c(7.06060606060606, 33, 1.57994054356869),
potato = c(3.34666666666667, 33, 1.36289077492212),
pain = c(4.17666666666667, 33, 1.25762044965971),
life = c(4.22121212121212, 33, 1.40884650861919)),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
# A tibble: 14 x 7
word pm_mean pm_n pm_SD un_mean un_n un_SD
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 hill 5.30 33 1.65 2.26 38 2.06
2 user 4.24 33 1.97 1.13 38 1.58
3 name 7.18 33 1.18 2.42 38 1.97
4 paint 3.27 33 1.72 4.18 38 1.81
5 smile 1.15 33 4.87 6.05 38 1.99
6 back 4.30 33 2.02 4.11 38 2.08
7 mouse 7.06 33 1.58 7.35 38 1.75
8 potato 3.35 33 1.36 5.95 38 2.01
9 pain 4.18 33 1.26 1.34 38 1.70
10 life 4.22 33 1.41 4.05 38 2.00
11 house NA NA NA 5.09 34 1.66
12 person NA NA NA 4.12 34 2.16
13 city NA NA NA 2.47 34 1.71
14 agressive NA NA NA 5 34 1.95
-----------------------
# Use the tidyverse.
library(tidyverse)
# Function to transform CSVs into a standard form.
standardize_csv <- function(csv_data, csv_prefix){
# Turn the word columns into a single column.
csv_data %>% pivot_longer(
# The word columns are every column except the 1st, which names the metric.
cols = !1,
names_to = "word"
) %>%
# Include the CSV prefix for reference.
mutate(
csv_prefix = csv_prefix
) %>%
# Rename and reformat the dataset.
select(
csv_prefix,
word,
metric = 1,
value
)
}
# Find all CSV variables named by your convention, within your workspace.
csv_list <- sapply(
X = ls(pattern = "^[a-z]{2,2}0[1-5]$"),
FUN = get,
simplify = FALSE,
USE.NAMES = TRUE
)
# Consolidate into the final form:
final_df <- csv_list %>%
mapply(
# Transform into standard form...
FUN = standardize_csv,
# ...the CSV datasets...
csv_data = .,
# ...with their prefixes.
csv_prefix = gsub(
x = names(.),
pattern = "^([a-z]*)(\\d*)$",
replacement = "\\1"
),
SIMPLIFY = FALSE
) %>%
# Stack those standardized datasets into a single table.
do.call(
what = bind_rows
) %>%
# Pivot the table to have one column for each family and metric ('un_mean',
# 'pm_SD', etc.).
pivot_wider(
names_from = c(csv_prefix, metric),
names_glue = "{csv_prefix}_{metric}",
values_from = value
)
# View the result.
final_df
un01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(2.26315789473684, 38, 2.0623289187203),
user = c(1.13157894736842, 38, 1.57978877533674),
name = c(2.42105263157895, 38, 1.96773403700762),
paint = c(4.18421052631579, 38, 1.81369062527503),
smile = c(6.05263157894737, 38, 1.98572430003074),
back = c(4.10526315789474, 38, 2.0767629916461),
mouse = c(7.35135135135135, 38, 1.75144727798686),
potato = c(5.94736842105263, 38, 2.01276156159657),
pain = c(1.34210526315789, 38, 1.69699759972873),
life = c(4.05263157894737, 38, 1.99928863593695)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
un05 <- structure(
list(
...1 = c("mean", "n", "SD"),
house = c(5.08823529411765, 34, 1.65817802638964),
person = c(4.11764705882353, 34, 2.15694376772143),
city = c(2.47058823529412, 34, 1.70978102651927),
agressive = c(5, 34, 1.95401684183679)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
pm01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(5.3030303030303, 33, 1.64857606142484),
user = c(4.24242424242424, 33, 1.96898297082375),
name = c(7.18181818181818, 33, 1.18465568453838),
paint = c(3.27272727272727, 33, 1.71887912738082),
smile = c(1.15151515151515, 33, 4.8728523053289),
back = c(4.3030303030303, 33, 2.02306772756204),
mouse = c(7.06060606060606, 33, 1.57994054356869),
potato = c(3.34666666666667, 33, 1.36289077492212),
pain = c(4.17666666666667, 33, 1.25762044965971),
life = c(4.22121212121212, 33, 1.40884650861919)),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
# A tibble: 14 x 7
word pm_mean pm_n pm_SD un_mean un_n un_SD
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 hill 5.30 33 1.65 2.26 38 2.06
2 user 4.24 33 1.97 1.13 38 1.58
3 name 7.18 33 1.18 2.42 38 1.97
4 paint 3.27 33 1.72 4.18 38 1.81
5 smile 1.15 33 4.87 6.05 38 1.99
6 back 4.30 33 2.02 4.11 38 2.08
7 mouse 7.06 33 1.58 7.35 38 1.75
8 potato 3.35 33 1.36 5.95 38 2.01
9 pain 4.18 33 1.26 1.34 38 1.70
10 life 4.22 33 1.41 4.05 38 2.00
11 house NA NA NA 5.09 34 1.66
12 person NA NA NA 4.12 34 2.16
13 city NA NA NA 2.47 34 1.71
14 agressive NA NA NA 5 34 1.95
-----------------------
# Use the tidyverse.
library(tidyverse)
# Function to transform CSVs into a standard form.
standardize_csv <- function(csv_data, csv_prefix){
# Turn the word columns into a single column.
csv_data %>% pivot_longer(
# The word columns are every column except the 1st, which names the metric.
cols = !1,
names_to = "word"
) %>%
# Include the CSV prefix for reference.
mutate(
csv_prefix = csv_prefix
) %>%
# Rename and reformat the dataset.
select(
csv_prefix,
word,
metric = 1,
value
)
}
# Find all CSV variables named by your convention, within your workspace.
csv_list <- sapply(
X = ls(pattern = "^[a-z]{2,2}0[1-5]$"),
FUN = get,
simplify = FALSE,
USE.NAMES = TRUE
)
# Consolidate into the final form:
final_df <- csv_list %>%
mapply(
# Transform into standard form...
FUN = standardize_csv,
# ...the CSV datasets...
csv_data = .,
# ...with their prefixes.
csv_prefix = gsub(
x = names(.),
pattern = "^([a-z]*)(\\d*)$",
replacement = "\\1"
),
SIMPLIFY = FALSE
) %>%
# Stack those standardized datasets into a single table.
do.call(
what = bind_rows
) %>%
# Pivot the table to have one column for each family and metric ('un_mean',
# 'pm_SD', etc.).
pivot_wider(
names_from = c(csv_prefix, metric),
names_glue = "{csv_prefix}_{metric}",
values_from = value
)
# View the result.
final_df
un01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(2.26315789473684, 38, 2.0623289187203),
user = c(1.13157894736842, 38, 1.57978877533674),
name = c(2.42105263157895, 38, 1.96773403700762),
paint = c(4.18421052631579, 38, 1.81369062527503),
smile = c(6.05263157894737, 38, 1.98572430003074),
back = c(4.10526315789474, 38, 2.0767629916461),
mouse = c(7.35135135135135, 38, 1.75144727798686),
potato = c(5.94736842105263, 38, 2.01276156159657),
pain = c(1.34210526315789, 38, 1.69699759972873),
life = c(4.05263157894737, 38, 1.99928863593695)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
un05 <- structure(
list(
...1 = c("mean", "n", "SD"),
house = c(5.08823529411765, 34, 1.65817802638964),
person = c(4.11764705882353, 34, 2.15694376772143),
city = c(2.47058823529412, 34, 1.70978102651927),
agressive = c(5, 34, 1.95401684183679)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
pm01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(5.3030303030303, 33, 1.64857606142484),
user = c(4.24242424242424, 33, 1.96898297082375),
name = c(7.18181818181818, 33, 1.18465568453838),
paint = c(3.27272727272727, 33, 1.71887912738082),
smile = c(1.15151515151515, 33, 4.8728523053289),
back = c(4.3030303030303, 33, 2.02306772756204),
mouse = c(7.06060606060606, 33, 1.57994054356869),
potato = c(3.34666666666667, 33, 1.36289077492212),
pain = c(4.17666666666667, 33, 1.25762044965971),
life = c(4.22121212121212, 33, 1.40884650861919)),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
# A tibble: 14 x 7
word pm_mean pm_n pm_SD un_mean un_n un_SD
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 hill 5.30 33 1.65 2.26 38 2.06
2 user 4.24 33 1.97 1.13 38 1.58
3 name 7.18 33 1.18 2.42 38 1.97
4 paint 3.27 33 1.72 4.18 38 1.81
5 smile 1.15 33 4.87 6.05 38 1.99
6 back 4.30 33 2.02 4.11 38 2.08
7 mouse 7.06 33 1.58 7.35 38 1.75
8 potato 3.35 33 1.36 5.95 38 2.01
9 pain 4.18 33 1.26 1.34 38 1.70
10 life 4.22 33 1.41 4.05 38 2.00
11 house NA NA NA 5.09 34 1.66
12 person NA NA NA 4.12 34 2.16
13 city NA NA NA 2.47 34 1.71
14 agressive NA NA NA 5 34 1.95
-----------------------
# Use the tidyverse.
library(tidyverse)
# Function to transform CSVs into a standard form.
standardize_csv <- function(csv_data, csv_prefix){
# Turn the word columns into a single column.
csv_data %>% pivot_longer(
# The word columns are every column except the 1st, which names the metric.
cols = !1,
names_to = "word"
) %>%
# Include the CSV prefix for reference.
mutate(
csv_prefix = csv_prefix
) %>%
# Rename and reformat the dataset.
select(
csv_prefix,
word,
metric = 1,
value
)
}
# Find all CSV variables named by your convention, within your workspace.
csv_list <- sapply(
X = ls(pattern = "^[a-z]{2,2}0[1-5]$"),
FUN = get,
simplify = FALSE,
USE.NAMES = TRUE
)
# Consolidate into the final form:
final_df <- csv_list %>%
mapply(
# Transform into standard form...
FUN = standardize_csv,
# ...the CSV datasets...
csv_data = .,
# ...with their prefixes.
csv_prefix = gsub(
x = names(.),
pattern = "^([a-z]*)(\\d*)$",
replacement = "\\1"
),
SIMPLIFY = FALSE
) %>%
# Stack those standardized datasets into a single table.
do.call(
what = bind_rows
) %>%
# Pivot the table to have one column for each family and metric ('un_mean',
# 'pm_SD', etc.).
pivot_wider(
names_from = c(csv_prefix, metric),
names_glue = "{csv_prefix}_{metric}",
values_from = value
)
# View the result.
final_df
un01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(2.26315789473684, 38, 2.0623289187203),
user = c(1.13157894736842, 38, 1.57978877533674),
name = c(2.42105263157895, 38, 1.96773403700762),
paint = c(4.18421052631579, 38, 1.81369062527503),
smile = c(6.05263157894737, 38, 1.98572430003074),
back = c(4.10526315789474, 38, 2.0767629916461),
mouse = c(7.35135135135135, 38, 1.75144727798686),
potato = c(5.94736842105263, 38, 2.01276156159657),
pain = c(1.34210526315789, 38, 1.69699759972873),
life = c(4.05263157894737, 38, 1.99928863593695)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
un05 <- structure(
list(
...1 = c("mean", "n", "SD"),
house = c(5.08823529411765, 34, 1.65817802638964),
person = c(4.11764705882353, 34, 2.15694376772143),
city = c(2.47058823529412, 34, 1.70978102651927),
agressive = c(5, 34, 1.95401684183679)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
pm01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(5.3030303030303, 33, 1.64857606142484),
user = c(4.24242424242424, 33, 1.96898297082375),
name = c(7.18181818181818, 33, 1.18465568453838),
paint = c(3.27272727272727, 33, 1.71887912738082),
smile = c(1.15151515151515, 33, 4.8728523053289),
back = c(4.3030303030303, 33, 2.02306772756204),
mouse = c(7.06060606060606, 33, 1.57994054356869),
potato = c(3.34666666666667, 33, 1.36289077492212),
pain = c(4.17666666666667, 33, 1.25762044965971),
life = c(4.22121212121212, 33, 1.40884650861919)),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
# A tibble: 14 x 7
word pm_mean pm_n pm_SD un_mean un_n un_SD
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 hill 5.30 33 1.65 2.26 38 2.06
2 user 4.24 33 1.97 1.13 38 1.58
3 name 7.18 33 1.18 2.42 38 1.97
4 paint 3.27 33 1.72 4.18 38 1.81
5 smile 1.15 33 4.87 6.05 38 1.99
6 back 4.30 33 2.02 4.11 38 2.08
7 mouse 7.06 33 1.58 7.35 38 1.75
8 potato 3.35 33 1.36 5.95 38 2.01
9 pain 4.18 33 1.26 1.34 38 1.70
10 life 4.22 33 1.41 4.05 38 2.00
11 house NA NA NA 5.09 34 1.66
12 person NA NA NA 4.12 34 2.16
13 city NA NA NA 2.47 34 1.71
14 agressive NA NA NA 5 34 1.95
-----------------------
# Use the tidyverse.
library(tidyverse)
# Function to transform CSVs into a standard form.
standardize_csv <- function(csv_data, csv_prefix){
# Turn the word columns into a single column.
csv_data %>% pivot_longer(
# The word columns are every column except the 1st, which names the metric.
cols = !1,
names_to = "word"
) %>%
# Include the CSV prefix for reference.
mutate(
csv_prefix = csv_prefix
) %>%
# Rename and reformat the dataset.
select(
csv_prefix,
word,
metric = 1,
value
)
}
# Find all CSV variables named by your convention, within your workspace.
csv_list <- sapply(
X = ls(pattern = "^[a-z]{2,2}0[1-5]$"),
FUN = get,
simplify = FALSE,
USE.NAMES = TRUE
)
# Consolidate into the final form:
final_df <- csv_list %>%
mapply(
# Transform into standard form...
FUN = standardize_csv,
# ...the CSV datasets...
csv_data = .,
# ...with their prefixes.
csv_prefix = gsub(
x = names(.),
pattern = "^([a-z]*)(\\d*)$",
replacement = "\\1"
),
SIMPLIFY = FALSE
) %>%
# Stack those standardized datasets into a single table.
do.call(
what = bind_rows
) %>%
# Pivot the table to have one column for each family and metric ('un_mean',
# 'pm_SD', etc.).
pivot_wider(
names_from = c(csv_prefix, metric),
names_glue = "{csv_prefix}_{metric}",
values_from = value
)
# View the result.
final_df
un01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(2.26315789473684, 38, 2.0623289187203),
user = c(1.13157894736842, 38, 1.57978877533674),
name = c(2.42105263157895, 38, 1.96773403700762),
paint = c(4.18421052631579, 38, 1.81369062527503),
smile = c(6.05263157894737, 38, 1.98572430003074),
back = c(4.10526315789474, 38, 2.0767629916461),
mouse = c(7.35135135135135, 38, 1.75144727798686),
potato = c(5.94736842105263, 38, 2.01276156159657),
pain = c(1.34210526315789, 38, 1.69699759972873),
life = c(4.05263157894737, 38, 1.99928863593695)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
un05 <- structure(
list(
...1 = c("mean", "n", "SD"),
house = c(5.08823529411765, 34, 1.65817802638964),
person = c(4.11764705882353, 34, 2.15694376772143),
city = c(2.47058823529412, 34, 1.70978102651927),
agressive = c(5, 34, 1.95401684183679)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
pm01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(5.3030303030303, 33, 1.64857606142484),
user = c(4.24242424242424, 33, 1.96898297082375),
name = c(7.18181818181818, 33, 1.18465568453838),
paint = c(3.27272727272727, 33, 1.71887912738082),
smile = c(1.15151515151515, 33, 4.8728523053289),
back = c(4.3030303030303, 33, 2.02306772756204),
mouse = c(7.06060606060606, 33, 1.57994054356869),
potato = c(3.34666666666667, 33, 1.36289077492212),
pain = c(4.17666666666667, 33, 1.25762044965971),
life = c(4.22121212121212, 33, 1.40884650861919)),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
# A tibble: 14 x 7
word pm_mean pm_n pm_SD un_mean un_n un_SD
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 hill 5.30 33 1.65 2.26 38 2.06
2 user 4.24 33 1.97 1.13 38 1.58
3 name 7.18 33 1.18 2.42 38 1.97
4 paint 3.27 33 1.72 4.18 38 1.81
5 smile 1.15 33 4.87 6.05 38 1.99
6 back 4.30 33 2.02 4.11 38 2.08
7 mouse 7.06 33 1.58 7.35 38 1.75
8 potato 3.35 33 1.36 5.95 38 2.01
9 pain 4.18 33 1.26 1.34 38 1.70
10 life 4.22 33 1.41 4.05 38 2.00
11 house NA NA NA 5.09 34 1.66
12 person NA NA NA 4.12 34 2.16
13 city NA NA NA 2.47 34 1.71
14 agressive NA NA NA 5 34 1.95
-----------------------
# Use the tidyverse.
library(tidyverse)
# Function to transform CSVs into a standard form.
standardize_csv <- function(csv_data, csv_prefix){
# Turn the word columns into a single column.
csv_data %>% pivot_longer(
# The word columns are every column except the 1st, which names the metric.
cols = !1,
names_to = "word"
) %>%
# Include the CSV prefix for reference.
mutate(
csv_prefix = csv_prefix
) %>%
# Rename and reformat the dataset.
select(
csv_prefix,
word,
metric = 1,
value
)
}
# Find all CSV variables named by your convention, within your workspace.
csv_list <- sapply(
X = ls(pattern = "^[a-z]{2,2}0[1-5]$"),
FUN = get,
simplify = FALSE,
USE.NAMES = TRUE
)
# Consolidate into the final form:
final_df <- csv_list %>%
mapply(
# Transform into standard form...
FUN = standardize_csv,
# ...the CSV datasets...
csv_data = .,
# ...with their prefixes.
csv_prefix = gsub(
x = names(.),
pattern = "^([a-z]*)(\\d*)$",
replacement = "\\1"
),
SIMPLIFY = FALSE
) %>%
# Stack those standardized datasets into a single table.
do.call(
what = bind_rows
) %>%
# Pivot the table to have one column for each family and metric ('un_mean',
# 'pm_SD', etc.).
pivot_wider(
names_from = c(csv_prefix, metric),
names_glue = "{csv_prefix}_{metric}",
values_from = value
)
# View the result.
final_df
un01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(2.26315789473684, 38, 2.0623289187203),
user = c(1.13157894736842, 38, 1.57978877533674),
name = c(2.42105263157895, 38, 1.96773403700762),
paint = c(4.18421052631579, 38, 1.81369062527503),
smile = c(6.05263157894737, 38, 1.98572430003074),
back = c(4.10526315789474, 38, 2.0767629916461),
mouse = c(7.35135135135135, 38, 1.75144727798686),
potato = c(5.94736842105263, 38, 2.01276156159657),
pain = c(1.34210526315789, 38, 1.69699759972873),
life = c(4.05263157894737, 38, 1.99928863593695)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
un05 <- structure(
list(
...1 = c("mean", "n", "SD"),
house = c(5.08823529411765, 34, 1.65817802638964),
person = c(4.11764705882353, 34, 2.15694376772143),
city = c(2.47058823529412, 34, 1.70978102651927),
agressive = c(5, 34, 1.95401684183679)
),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
pm01 <- structure(
list(
...1 = c("mean", "n", "SD"),
hill = c(5.3030303030303, 33, 1.64857606142484),
user = c(4.24242424242424, 33, 1.96898297082375),
name = c(7.18181818181818, 33, 1.18465568453838),
paint = c(3.27272727272727, 33, 1.71887912738082),
smile = c(1.15151515151515, 33, 4.8728523053289),
back = c(4.3030303030303, 33, 2.02306772756204),
mouse = c(7.06060606060606, 33, 1.57994054356869),
potato = c(3.34666666666667, 33, 1.36289077492212),
pain = c(4.17666666666667, 33, 1.25762044965971),
life = c(4.22121212121212, 33, 1.40884650861919)),
row.names = c(NA, -3L),
class = c("tbl_df", "tbl", "data.frame")
)
# A tibble: 14 x 7
word pm_mean pm_n pm_SD un_mean un_n un_SD
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 hill 5.30 33 1.65 2.26 38 2.06
2 user 4.24 33 1.97 1.13 38 1.58
3 name 7.18 33 1.18 2.42 38 1.97
4 paint 3.27 33 1.72 4.18 38 1.81
5 smile 1.15 33 4.87 6.05 38 1.99
6 back 4.30 33 2.02 4.11 38 2.08
7 mouse 7.06 33 1.58 7.35 38 1.75
8 potato 3.35 33 1.36 5.95 38 2.01
9 pain 4.18 33 1.26 1.34 38 1.70
10 life 4.22 33 1.41 4.05 38 2.00
11 house NA NA NA 5.09 34 1.66
12 person NA NA NA 4.12 34 2.16
13 city NA NA NA 2.47 34 1.71
14 agressive NA NA NA 5 34 1.95
QUESTION
All elements of the page move after changing the size of the window
Asked 2022-Apr-15 at 18:37I am new to coding, my code moves when I change the size of the browser window (divs and pictures start moving up and down and as a result my web page can only be correctly visible in one window size.
What should I change to adapt the page to different screen sizes?
Please let me know if I have some other mistakes in the code as well.
Here is the code: https://codepen.io/btb8293/pen/WNdYrZj
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Portfolio website</title>
<link rel="stylesheet" href="carsharing.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@700&family=Plus+Jakarta+Sans:ital,wght@1,200&family=Work+Sans:ital,wght@0,200;1,200&display=swap');
</style>
<script src="https://kit.fontawesome.com/2d0427e8be.js" crossorigin="anonymous"></script>
</head>
<body>
<nav>
<button class="btn" id="btn-1">PROPAGANDA</button>
<ul>
<li><a href="#contacts">Contacts</a></li>
<li><a href="#about">About</a></li>
<li><a href="#">Help</a></li>
</ul>
</nav>
<div class="intro">
<i class="fa-solid fa-car-rear" id="car"></i>
<h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vel cupiditate soluta ratione nam non, officiis fugiat sunt, blanditiis nesciunt nemo ab eaque accusamus cum doloribus odio, vitae esse hic sed?</h1>
<div class="info-box">
<div class="text-in-the-box">
<p>Dolore consequuntur sunt dolores pariatur, labore excepturi adipisci aliquam exercitationem autem dignissimos, quisquam praesentium, laboriosam nam velit.</p>
</div>
</div>
<div class="text">
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Magni commodi maiores dolores quam accusamus, cupiditate explicabo suscipit fuga dolor libero obcaecati expedita illo ipsum quibusdam ea. Odit omnis nostrum enim!</p>
</div>
<div class="btn" id="btn-div">
<button id="btn-2"><a href="#"></a><b>Buy NOW!</b></button>
</div>
</div>
<div class="work">
<div class="container">
<div class="text">
<h1>Dear All</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Nobis porro aut rem possimus veritatis est, non cupiditate hic voluptates exercitationem eius enim nam, odit unde nisi aliquam molestiae, assumenda velit?</p>
</div>
<div class="big-box-1">
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Laboriosam distinctio consequuntur atque dolorem quas quaerat iusto odio soluta illum asperiores, eaque dolorum adipisci vitae. Minima mollitia commodi iste voluptates enim.</p>
<img src="https://media.istockphoto.com/photos/lighthouse-picture-id139497126?k=20&m=139497126&s=612x612&w=0&h=742ggWJZuxPE0jOPXfEfXV__XQhsmWgNq3mHV2tBMwE=" width="200px" alt="">
</div>
<div class="big-box-2">
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Laboriosam distinctio consequuntur atque dolorem quas
quaerat iusto odio soluta illum asperiores, eaque dolorum adipisci vitae. Minima mollitia commodi iste
voluptates enim.</p>
<img src=https://cdn.pixabay.com/photo/2019/09/29/22/06/light-bulb-4514505_640.jpg width="200px" alt="">
</div>
<div class="small-boxes">
<div class="small-box-1">
<p>Nice view baby o go go and see anothe big city in your dreams</p>
<img src="https://cdn.pixabay.com/photo/2017/02/16/23/10/smile-2072907_640.jpg" width="200px" alt="">
</div>
<div class="small-box-2">
<p>Nice view baby o go go and see anothe big city in your dreams</p>
<img src="https://cdn.pixabay.com/photo/2017/02/16/23/10/smile-2072907_640.jpg" width="200px" alt="">
</div>
<div class="small-box-3">
<p>Nice view baby o go go and see anothe big city in your dreams</p>
<img src="https://cdn.pixabay.com/photo/2017/02/16/23/10/smile-2072907_640.jpg" width="200px"alt="">
</div>
<div class="small-box-4">
<p>Nice view baby o go go and see anothe big city in your dreams</p>
<img src="https://cdn.pixabay.com/photo/2017/02/16/23/10/smile-2072907_640.jpg" width="200px" alt="">
</div>
</div>
</div>
</div>
<div class="contacts">
<button class="btn" id="btn-1">PROPKA</button>
<div id="text-contacts"></div>
<p>2019-2022 copyrighted</p>
<p>+ 9-999-99-999</p>
<p>123@zaec.com</p>
</div>
</div>
</body>
</html>
* {
padding: 0 0;
margin: 0 0;
}
h1,
h2,
h3,
h4,
h5,
h6,
p,
a {
font-family: 'Lato',
sans-serif;
font-family: 'Plus Jakarta Sans',
sans-serif;
font-family: 'Work Sans',
sans-serif;
}
nav {
height: 100px;
position: absolute;
}
#btn-1 {
background: pink;
margin-top: 20px;
margin-left: 20px;
width: 150px;
height: 50px;
border-radius: 20px;
webkit-box-shadow: 10px 10px 27px -16px rgba(0, 0, 0, 0.61);
-moz-box-shadow: 10px 10px 27px -16px rgba(0, 0, 0, 0.61);
box-shadow: 10px 10px 27px -16px rgba(0, 0, 0, 0.61);
cursor: pointer;
}
nav ul {
list-style: none;
margin-left: 35vw;
}
nav ul li {
display: inline;
margin: 40px;
}
nav a {
color: black;
text-decoration: none;
font-weight: bolder;
text-shadow: 1px 1px 13px rgba(150, 150, 150, 1);
}
.intro {
background: pink;
margin: 0 auto;
padding-top: 150px;
height: 110vh;
}
#car {
font-size: 250px;
color: black;
padding-left: 40vw;
margin-bottom: 50px;
text-shadow: 11px 11px 0px rgba(137, 137, 139, 0.5);
}
.intro h1 {
margin-bottom: 50px;
margin-left: 10vw;
margin-right: 10vw;
}
.text {
margin-bottom: 100px;
margin-left: 10vw;
margin-right: 10vw;
font-size: 20px;
}
.info-box {
width: 50vw;
height: 12vh;
border: 1px solid black;
margin-bottom: 50px;
margin-left: 25vw;
border-radius: 30px;
webkit-box-shadow: 10px 10px 27px -16px rgba(0, 0, 0, 0.61);
-moz-box-shadow: 10px 10px 27px -16px rgba(0, 0, 0, 0.61);
box-shadow: 10px 10px 27px -16px rgba(0, 0, 0, 0.61);
}
.text-in-the-box {
font-size: 18px;
text-align: center;
margin-top: 13px;
padding-top: 15px;
padding-bottom: 5px;
}
#btn-div {
margin-left: 43vw;
}
#btn-2 {
width: 180px;
height: 50px;
background: red;
border-radius: 20px;
font-size: 20px;
font-family: 'Lato',
sans-serif;
font-family: 'Plus Jakarta Sans', sans-serif;
font-family: 'Work Sans', sans-serif;
font-weight: 900;
cursor: pointer;
-webkit-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
color: white;
}
.work {
margin-top: 0px;
background: #F0F8FF;
height: 150vh;
}
.text h1 {
margin-bottom: 40px;
padding-top: 50px;
}
.big-box-1 {
width: 20vw;
height: 50vh;
border: 1px solid black;
margin-left: 25vw;
border-radius: 40px;
float: left;
margin-bottom: 50px;
-webkit-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
}
.big-box-2 {
width: 20vw;
height: 50vh;
border: 1px solid black;
float: right;
margin-right: 25vw;
border-radius: 40px;
margin-bottom: 50px;
-webkit-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
}
.big-box-1 p {
padding-top: 3vh;
padding-left: 10px;
padding-right: 10px;
}
.big-box-1 img {
width: 18vw;
height: 25vh;
margin-top: 4vh;
margin-left: 1vw;
margin-right: 1vw;
border-radius: 20px;
}
.big-box-2 p {
padding-top: 3vh;
padding-left: 10px;
padding-right: 10px;
}
.big-box-2 img {
width: 18vw;
height: 25vh;
margin-top: 4vh;
margin-left: 1vw;
margin-right: 1vw;
border-radius: 20px;
}
.small-box-1 {
margin-top: 100px;
width: 15vw;
height: 20vw;
border: 1px solid black;
float: left;
margin-left: 8vw;
margin-bottom: 20vh;
border-radius: 20px;
-webkit-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
}
.small-box-1 p {
padding-top: 3vh;
margin-bottom: 2vh;
padding-left: 5px;
padding-right: 5px;
}
.small-box-1 img {
width: 13vw;
height: 13vw;
padding-left: 1vw;
padding-right: 1vw;
padding-top: 1vh;
border-radius: 30px;
}
.small-box-2 {
margin-top: 100px;
width: 15vw;
height: 20vw;
border: 1px solid black;
float: left;
margin-left: 8vw;
margin-bottom: 20vh;
border-radius: 20px;
-webkit-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
}
.small-box-2 p {
padding-top: 3vh;
margin-bottom: 2vh;
padding-left: 5px;
padding-right: 5px;
}
.small-box-2 img {
width: 13vw;
height: 13vw;
padding-left: 1vw;
padding-right: 1vw;
padding-top: 1vh;
border-radius: 30px;
}
.small-box-3 {
margin-top: 100px;
width: 15vw;
height: 20vw;
border: 1px solid black;
float: left;
margin-left: 8vw;
margin-bottom: 20vh;
border-radius: 20px;
-webkit-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
}
.small-box-3 p {
padding-top: 3vh;
margin-bottom: 2vh;
padding-left: 5px;
padding-right: 5px;
}
.small-box-3 img {
width: 13vw;
height: 13vw;
padding-left: 1vw;
padding-right: 1vw;
padding-top: 1vh;
border-radius: 30px;
}
.small-box-4 {
margin-top: 100px;
width: 15vw;
height: 20vw;
border: 1px solid black;
float: left;
margin-left: 8vw;
margin-bottom: 20vh;
border-radius: 20px;
-webkit-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
box-shadow: 10px 10px 28px -12px rgba(0, 0, 0, 0.75);
}
.small-box-4 p {
padding-top: 3vh;
margin-bottom: 2vh;
padding-left: 5px;
padding-right: 5px;
}
.small-box-4 img {
width: 13vw;
height: 13vw;
padding-left: 1vw;
padding-right: 1vw;
padding-top: 1vh;
border-radius: 30px;
}
.contacts {
height: 25vh;
background: pink;
}
.contacts p {
text-align: center;
}
ANSWER
Answered 2022-Apr-15 at 18:37You can use Media Queries to target different device viewports and apply specific styling. You can read more about responsive styling and viewports here and here
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Explore Related Topics
Save this library and start creating your kit