Data storage in Python

A List of Class Objects (Python)

Change item in List of class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Person():
def __init__(self, name, surname):
self.name = name
self.surname = surname

lidi = []

lidi.append(Person('lukas', 'novak'))
lidi.append(Person('veronika', 'novakova'))

def first(iterable, default=None):
for item in iterable:
return item
return default

print(lidi)
clovek = first(x for x in lidi if x.name == 'veronika')
clo = filter(lambda x: x.name == 'veronika', lidi)
print(clo)
print(clovek)
print(clo[0].name)
print(clovek.name)
clovek.name = 'tonda'
print(clovek.name)
print(lidi[1].name)

Console output:

1
2
3
4
5
6
7
8
pydev debugger: starting (pid: 22355)
[<__main__.Person instance at 0x7ff3caa5ac20>, <__main__.Person instance at 0x7ff3caa5ac68>]
[<__main__.Person instance at 0x7ff3caa5ac68>]
<__main__.Person instance at 0x7ff3caa5ac68>
veronika
veronika
tonda
tonda

Source

Searching a list of objects in Python

DataGridView C#

Change font size and row Height

For specific cell and rows in List HeadlineRow = new List();

1
2
3
4
5
6
7
8
9
10
DataGridViewCellStyle style = new DataGridViewCellStyle();
style.Font = new Font(dataGridView1.Font.FontFamily, 14, FontStyle.Bold);


foreach (var item in HeadlineRow)
{
DataGridViewRow row = dataGridView1.Rows[item];
dataGridView1.Rows[item].Cells[1].Style.ApplyStyle(style);
row.Height = 30;
}

https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-format-data-in-the-windows-forms-datagridview-control

Change column Width

For specific row in List HeadlineRow = new List();

1
2
DataGridViewColumn column = dataGridView1.Columns[1];
column.Width = 600;

Automatic wrap Line

1
2
dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;

https://stackoverflow.com/questions/2154154/datagridview-how-to-set-column-width

Check for empty Cell

Columns = Enum

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 DataTable dt = new DataTable();

DataRow dr = dt.NewRow();

if (!dr.IsNull("ColumnName"))
{
dt.Rows.Add(dr);
dr = dt.NewRow();
CurentColumn = Columns.none;
if (Headline)
{
HeadlineRow.Add(rowNum);
Headline = false;
}
rowNum++;
}

Drag & Drop

https://social.msdn.microsoft.com/Forums/vstudio/en-US/644ebd2b-1760-4c8e-9faf-63f7c0d2cba5/drag-and-drop-not-working-with-windows-81?forum=vbgeneral

Read data from Text File and put it to datagridview

How to read /load text (*.txt) file values in datagridview using C# ..?

Hauwei push files

1
2
3
4
/media/lukas/Data/Android/android-sdk-linux/platform-tools$ ./adb shell
df
/storage/sdcard0/oruxmaps/tracklogs
./adb push '/home/lukas/Downloads/Kunraticky les2.gpx' /storage/sdcard0/oruxmaps/tracklogs

Setup Gogs

How To Set Up Gogs on Ubuntu 14.04

Set Database
Gogs(Go Git Service)
https://dev.mysql.com/doc/refman/5.7/en/charset-database.html

https://github.com/gogits/gogs/blob/master/scripts/systemd/gogs.service

https://gogs.io/docs/intro/faqs

MySQL Command Line Cheatsheet

Path for older MySQL

fixed Error MySql /Mariadb error: max key length is 767 byte
v0.11.34_patch

Other solution
Upgrade mariadb version to 10.2 or higher.
Upgrade mysql version to 5.7 or higher.

Settings file Path

1
/opt/gogs/custom/conf/app.ini

Transfer repositories to Gogs

The clone bare brings down all refs/tags/etc, and the push –mirror pushes everything back up.

1
2
3
4
git clone --bare git@github.com:old/repo.git
cd repo
git remote add origin git@github.com:new/repo.git
git push --mirror

Resource

See Second Comment
Moving A Git Repository To A New Server