210
Points
Questions
40
Answers
39
-
Asked on July 16, 2020 in Mysql.
select t1.personid, t1.personname, group_concat(t2.PurchaseItem) from t1 join t2 on t1.personid = t2.personid group by t1.personid, t1.personname
- 397 views
- 3 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
I made a mistake when I copied other’s app1.cnf explanation into my app1.cnf. The #comment after parameters in the same line should be removed.
- 368 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in Python.
As normal, it is pretty funky/tedious with matplotlib. But here it is!
f = plt.figure(constrained_layout = True) spec = f.add_gridspec(ncols = 1, nrows = 4, height_ratios = [1,1,1,.5]) ax0 = f.add_subplot(spec[0]) ax0 = sns.heatmap(df,cbar=False,cmap=cmap) ax1 = f.add_subplot(spec[1]) ax1 = sns.heatmap(df2,cbar=False,cmap=cmap) ax2 = f.add_subplot(spec[2]) ax2 = sns.heatmap(df3,cbar=False,cmap=cmap) ax3 = f.add_subplot(spec[3]) ax3 = sns.heatmap(df4,cbar=False,cmap=cmap)
You can change the heights relative to each other using the height_ratios. You could also implement a wdith_ratios parameter if you desired to change the relative widths. You could also implement a for loop to iterate over the graphing.
- 349 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Python.
It would be better if you could show us which process are using your GPU. Because sometimes many utils process use the GPU too under same user name.
However, please try,
- Find out all running process
pid
which are using the GPU. This tool may help. - Kill process by PID by this command:
kill -9 <pid>
(be sure this pid is under your username)
- 0 views
- 1 answers
- 0 votes
- Find out all running process
-
Asked on July 16, 2020 in Python.
Sounds like you can use the min/max function with
key=
and a custom comparison object that treatsNone
specially:class Predicate: def __init__(self, item): self.item = item def __lt__(self, other): try: return self.item < other.item except TypeError: return False print(min([0, 1, 2, None, 3, 4], key=Predicate)) print(min([None], key=Predicate)) print(max([0, 1, 2, 3, None, 4, 5], key=Predicate)) print(max([None], key=Predicate))
Output:
0 None 5 None 0
Do you have some more examples or tests around what the expected results should be?
- 337 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in Python.
As seen on this post, you can find the dimensions of the regular shell (aka command prompt) in columns and rows of characters.
To find the number of spaces to use on the left, you could use the following formula:
(shell width - text width) / 2
and then round down using
int()
.str.centre(text[, fillchar])
is also a good alternative to centering the text.But in IDLE I’m not entirely confident it can be done. If you really want to have centered text, I can suggest this:
- Using the formula and the normal shell (cmd)
- Hard coding a width and hoping others use it
- Using a proper GUI system (for example tkinter)
- 347 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Python.
Try this:
plt.figure(figsize=(10,10)) countries=df.Country.unique() for country in countries: grouped=df[df.Country==country].groupby('year').count() years=list(grouped.index) wins=list(grouped.Result) plt.plot(years,wins,label=country) plt.legend()
- 403 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in php.
I found the solution: uninstall the extension PHP Mess Detector(phpmd), then delete all of the migrations and files that created and create them again. This worked for me perfectly.
- 343 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in php.
Don’t you rewrite the value in the array every time?
$record = array(); foreach ($result as $key => $row) { $query = // mysql query $rows = $query->result_array(); $record[] = [ 'bookingId' => $rows['0']['bookingId'], 'userId' => $rows['0']['userId'], 'status' => $rows['0']['status'], ]; } echo "<pre>"; print_R($record);
- 320 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in HTML.
To hide elements simply use the .d-none class or one of the .d-{sm,md,lg,xl}-none classes for any responsive screen variation.
To show an element only on a given interval of screen sizes you can combine one .d--none class with a .d--* class, for example .d-none .d-md-block .d-xl-none will hide the element for all screen sizes except on medium and large devices.
See their official docs: https://getbootstrap.com/docs/4.5/utilities/display/
- 359 views
- 1 answers
- 0 votes