1.Alembic is a Python database migration tool written by sqlalchemy authors. It enables synchronous updates of model classes and databases. (Installation and operation steps using Alembic Migration database)
To add a database field Operation process using Alembic:
Switch to the Db_migrate directory
(1). Add content to model.py
(2). Run Alembic revision--autogenerate-m "comment content" to build a database migration file
(3). Run Alembic upgrade head to update the contents of the migrated file to the database
2.liunx command (see linux System hardware configuration for details)
(1) View CPU
grep "model Name"/proc/cpuinfo | Cut-f2-d:
(2) View memory
grep Memtotal/proc/meminfo | Cut-f2-d:
(3) View the current version of Linux
Cat/etc/redhat-release
(4) View kernel version
Uname-a
(5) View Ip,mac address
Ifconfig
View Gateway
Cat/etc/sysconfig/network
View DNS
Cat/etc/resolv.conf
3.angularjs, if you want to manipulate the DOM element, the most appropriate way is to add instructions on the DOM, on the one hand can be used in multiple places, on the other hand, the instruction is done after the element is loaded, to ensure that the element must exist.
Will
// drawpage ($scope, $http, 1,util);
Transformed into
<id= "Main_client_order" clientorder></ div>
function Clientorder (Util, $http) { return { ' A ', function ($ Scope, element, attrs) { drawpage ($scope, $http,1, Util);}} ;
Because in the Drawpage method, there is an operation to replace the element
function Drawpanel (ScreenWidth, screenheight) { = d3.select (' #main_client_order ') . Append (' SVG: SVG ') . attr (' width ', screenwidth+100). attr (' height ', screenheight+100) . Style ("Margin-left", "20px") . Style ("Margin-top", "20px") . attr ("id", " OrderId "); = svg; }
4. Database associated with the field, first of all to consider whether in the model through the method and other content to obtain, if possible, add it. On the one hand, the maintenance of the added field after the deletion of the modification, on the other hand, the full use of SQLAlchemy function.
model.py
class Clientgroup (Base): __tablename__ ' Clientgroup ' = Column (String (255)) def Client_count (self): return Thinclient.query.filter_by (group_id=self.id). Count ()
serializer.py
class Clientgroupserializer (Schema): = fields. Function (Lambda c:c.client_count ()) class Meta: = All_fields ( Clientgroup) +['client_count']
The page gets as follows:
< TD > {{Group.client_count}} </ TD >
5.angularjs when the class name or method name is the parameter of the processing method:
(1) class names and method names are parameters
var resource = $scope. case? function (data) { },function(e) { })
(2) method name is parameter
var fun_name = "Add"function (data) { },function(e) { })
Python, angular JS learning record "3"