230
Points
Questions
44
Answers
52
-
Asked on July 16, 2020 in Mysql.
I Found solution of this.
- First i copy the database frm files for backup.
- Then i removed sql server completely.
- Then i install sql server again.
- after that i copy the frm files and paste in /var/lib/mysql
- run command sudo chown -R mysql:mysql /var/lib/mysql.
- And last restart the sql server with sudo service mysql restart
- 368 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
Wamp works with another php.ini that is in C:\wamp\bin\apache\Apache2.4.4\bin\php.ini. So you need to manualy find the correct file, that is in C:\wamp\bin\php\php5.4.12\php.ini. Uncomment the extension=php_openssl.dll line and just try to install Composer again.
- 687 views
- 18 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
The standard relational SQL way to handle this problem would be to maintain three tables:
clients (id, name, ...) products (id, name, ...) client_products (client_id, product_id) -- primary key is client_id, product_id
The third table above is called a junction table, because it exists to store relationships between clients and the the products to which they have subscribed. For example, to use your sample data,
client_products
might have the following entries:client_id | product_id 1 | 1 1 | 2
And in
products
:id | name 1 | SM 2 | NDVI
- 393 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Python.
All that you have to do is remove the "after" part from your regexp to ensure that the regexp only matches the part that you are interested in replacing with each match, and then there will be multiple matches replaced. By including the "after" part in your regexp, the whole string is matched on the first match, and nothing more happens after that.
text = "some outside text (some inside text) some other outside text (some inside text)" p = re.compile('(?P<before>.*?)\((?P<innertext>.*?)\)') print(p.sub("(\g<before>)\g<innertext>",text))
gives
(some outside text )some inside text( some other outside text )some inside text
Though you might also want to handle the whitespace slightly differently:
>>> p = re.compile('\s*(?P<before>.*?)\s*\((?P<innertext>.*?)\)') >>> p.sub("(\g<before>) \g<innertext> ",text).strip() '(some outside text) some inside text (some other outside text) some inside text'
- 340 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in Python.
This required a lot of data transformation:
- use
np.where()
,.shift
and.groupby
+.transform
to create some intermediary columns to calculate the data ranges of the groups. - Create an intermediary dataframe
df2
to calculate some more metrics includinghigh_hat_date
andnum_hat
. These calculations require a focus on the max values (i.e. high hat), so it was easier to create this new dataframe this way. - Merge df2 back into df1, take only the required columns and drop duplicate rows
code:
import pandas as pd, numpy as np df1=df.copy() df1['date'] = pd.to_datetime(df1['date'], dayfirst=True) df1['date_diff'] = df1['date'] - df1.shift()['date'] df1['date_first'] = '' df1['date_first'] = np.where((df1['date_diff'].isnull()) | ((df1['date_diff'] != '1 days') & (df1.shift()['date_diff'] == '1 days')), 'start_date', df1['date_first']) df1['date_first'] = np.where((df1['date_diff'] == '1 days') & (df1.shift(-1)['date_diff'] != '1 days'), 'end_date', df1['date_first']) df1['date_group'] = df1.groupby(df1['date_first'])['date_first'].transform('cumcount') df1['date_group2'] = df1.groupby(df1['date_first'])['date_group'].transform('cumsum').replace(0,np.nan).ffill().astype(int) df1['start_date'] = df1.groupby('date_group2')['date'].transform('min') df1['end_date'] = df1.groupby('date_group2')['date'].transform('max') df1['high_hat'] = df1.groupby(df1['date_group2'])['hats'].transform('max') df2 = df1.loc[df1['high_hat'] == df1['hats']] df2['high_hat_date'] = df2.groupby('date_group2')['date'].transform('first') df2['num_hat'] = df2.groupby('date_group2')['hats'].transform('count') df2 = df2.drop_duplicates(subset='date_group2') df1 = pd.merge(df1, df2[['date_group2', 'high_hat_date', 'num_hat']], how='outer', on=['date_group2']) df1 = df1[['index', 'start_date', 'end_date', 'high_hat', 'high_hat_date', 'num_hat']].drop_duplicates() df1
output:
index start_date end_date high_hat high_hat_date num_hat 0 A1 2020-01-01 2020-01-04 16 2020-01-03 2 4 A1 2020-01-21 2020-01-23 9 2020-01-21 1 7 A6 2020-03-20 2020-03-21 5 2020-03-20 2 9 A8 2020-07-30 2020-07-30 12 2020-07-30 1
- 0 views
- 2 answers
- 0 votes
- use
-
Asked on July 16, 2020 in Python.
The usual approach is to uppercase the strings or lower case them for the lookups and comparisons. For example:
>>> "hello".upper() == "HELLO".upper() True >>>
- 414 views
- 10 answers
- 0 votes
-
Asked on July 16, 2020 in php.
Yeah, you use reflection. Look at the output of
<? Reflection::export(new ReflectionClass('YourClass')); ?>
That should give you the idea of what you’ll be looking at.
- 678 views
- 12 answers
- 0 votes
-
Asked on July 16, 2020 in HTML.
The last two rule-sets, which are conditional on the input being
:valid
or:invalid
, add the content to::before
.The rule-set you are confused about applies no matter if it is
:valid
or:invalid
and sets rules which are used for both conditions.
The content is not separately positioned to their container, so what are they talking about?
The generated content is the pseudo-element containing the
✖
or the✓
.That generated content is
position: absolute
so is positioned with respect to the nearest ancestor that is positioned: i.e. thespan
.And what ‘different generated content’ having to be positioned with absolute are they talking about?
✖
is different to✓
.- 333 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in HTML.
I actually Ended up changing the first part of the comparison to
===
instead==
and i also realized that i put the value to’null’
(as a string) and actually not as a number therefore the 1st if was failing to successfully detect ifnull=‘null’
there fore making the 2nd if appear true- 286 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in CSS.
<div class="container h-100"> <div class="row align-items-center text-center"> <div class="col col-4 mx-auto"> 1 of 2 </div> <div class="col col-4 mx-auto"> 2 of 2 </div> <div class="col col-4 mx-auto"> Extra </div> </div> </div>
I used the
mx-auto
class on your divs, I’ve also added thetext-center
class to center the text for effect.See pen – https://codepen.io/buzztnt/pen/MWKVZpB
- 333 views
- 4 answers
- 0 votes