hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 98
values | lang stringclasses 21
values | max_stars_repo_path stringlengths 3 945 | max_stars_repo_name stringlengths 4 118 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 945 | max_issues_repo_name stringlengths 4 118 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 945 | max_forks_repo_name stringlengths 4 135 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1 1.03M | max_line_length int64 2 1.03M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
40a2bdf206d1056975dd802a268e4c516882a730 | 7,058 | py | Python | Modules/PlotterGui3D.py | ChengChengYang0416/trajectory-orientation-plotter | 259c793ba8d9f7a82f89936973e0575148e9a622 | [
"MIT"
] | null | null | null | Modules/PlotterGui3D.py | ChengChengYang0416/trajectory-orientation-plotter | 259c793ba8d9f7a82f89936973e0575148e9a622 | [
"MIT"
] | null | null | null | Modules/PlotterGui3D.py | ChengChengYang0416/trajectory-orientation-plotter | 259c793ba8d9f7a82f89936973e0575148e9a622 | [
"MIT"
] | null | null | null | import tkinter as tk
from Modules.ButtonUtility import CButtonUtility
class CPlotterGui3D:
def __init__( self, Plot3DWindow ):
self.Win = Plot3DWindow
self.InitBasicSetting()
self.InitFrame()
self.InitLabel()
self.InitEntry()
self.InitButton()
def InitBasicSetting( self ):
# set title
self.Win.title( "Plotter Gui 3D" )
# set geometry of window ( width x height )
self.Win.geometry( "430x279" )
self.Win.resizable( False, False )
# color, transparency, pin on top
self.Win.config( background = "#C0C0C0" )
self.Win.attributes( "-topmost", True )
def InitFrame( self ):
# frame for 3D plot
self.Frame3DPlot = tk.LabelFrame( self.Win, width = 420, height = 269, text = "3D Graph" )
self.Frame3DPlot.place( x = 5, y = 5 )
# frame for parameters of 3D plot
self.Frame3DPlotParam = tk.LabelFrame( self.Frame3DPlot, width = 410, height = 150, text = "Parameters" )
self.Frame3DPlotParam.place( x = 3, y = 65 )
def InitLabel( self ):
self.Init3DPlotLabel()
def InitEntry( self ):
self.Init3DPlotEntry()
def InitButton( self ):
# button object
self.ButtonUtility = CButtonUtility()
self.Init3DPlotButton()
def Init3DPlotLabel( self ):
# X axis lower bound label
self.LabelXAxisLower = tk.Label( self.Frame3DPlotParam, text = "XAxisLower" )
self.LabelXAxisLower.place( x = 0, y = 0, width = 95, height = 28 )
# X axis upper bound label
self.LabelXAxisUpper = tk.Label( self.Frame3DPlotParam, text = "XAxisUpper" )
self.LabelXAxisUpper.place( x = 200, y = 0, width = 95, height = 28 )
# Y axis lower bound label
self.LabelYAxisLower = tk.Label( self.Frame3DPlotParam, text = "YAxisLower" )
self.LabelYAxisLower.place( x = 0, y = 32, width = 95, height = 28 )
# Y axis upper bound label
self.LabelYAxisUpper = tk.Label( self.Frame3DPlotParam, text = "YAxisUpper" )
self.LabelYAxisUpper.place( x = 200, y = 32, width = 95, height = 28 )
# Z axis lower bound label
self.LabelZAxisLower = tk.Label( self.Frame3DPlotParam, text = "ZAxisLower" )
self.LabelZAxisLower.place( x = 0, y = 64, width = 95, height = 28 )
# Z axis upper bound label
self.LabelZAxisUpper = tk.Label( self.Frame3DPlotParam, text = "ZAxisUpper" )
self.LabelZAxisUpper.place( x = 200, y = 64, width = 95, height = 28 )
# convert unit label
self.LabelConvertUnit = tk.Label( self.Frame3DPlotParam, text = "ConvertUnit" )
self.LabelConvertUnit.place( x = 0, y = 96, width = 95, height = 28 )
# sample interval label
self.LabelSampleInterval = tk.Label( self.Frame3DPlotParam, text = "SampleInterval" )
self.LabelSampleInterval.place( x = 200, y = 96, width = 95, height = 28 )
def Init3DPlotEntry( self ):
# txt file path entry
self.StringFilePath = tk.StringVar()
self.EntryOpenFile = tk.Entry( self.Frame3DPlot, textvariable = self.StringFilePath )
self.EntryOpenFile.place( x = 102, y = 2, width = 310, height = 28 )
# xml parameter file path entry
self.StringLoadParam = tk.StringVar()
self.EntryLoadParam = tk.Entry( self.Frame3DPlot, textvariable = self.StringLoadParam )
self.EntryLoadParam.place( x = 102, y = 35, width = 310, height = 28 )
# X axis lower bound entry
self.StringXAxisLower = tk.StringVar()
self.EntryXAxisLower = tk.Entry( self.Frame3DPlotParam, textvariable = self.StringXAxisLower )
self.EntryXAxisLower.place( x = 97, y = 0, width = 100, height = 28 )
# X axis upper bouond entry
self.StringXAxisUpper = tk.StringVar()
self.EntryXAxisUpper = tk.Entry( self.Frame3DPlotParam, textvariable = self.StringXAxisUpper )
self.EntryXAxisUpper.place( x = 300, y = 0, width = 100, height = 28 )
# Y axis lower bound entry
self.StringYAxisLower = tk.StringVar()
self.EntryYAxisLower = tk.Entry( self.Frame3DPlotParam, textvariable = self.StringYAxisLower )
self.EntryYAxisLower.place( x = 97, y = 32, width = 100, height = 28 )
# Y axis upper bouond entry
self.StringYAxisUpper = tk.StringVar()
self.EntryYAxisUpper = tk.Entry( self.Frame3DPlotParam, textvariable = self.StringYAxisUpper )
self.EntryYAxisUpper.place( x = 300, y = 32, width = 100, height = 28 )
# Z axis lower bound entry
self.StringZAxisLower = tk.StringVar()
self.EntryZAxisLower = tk.Entry( self.Frame3DPlotParam, textvariable = self.StringZAxisLower )
self.EntryZAxisLower.place( x = 97, y = 64, width = 100, height = 28 )
# X axis upper bound entry
self.StringZAxisUpper = tk.StringVar()
self.EntryZAxisUpper = tk.Entry( self.Frame3DPlotParam, textvariable = self.StringZAxisUpper )
self.EntryZAxisUpper.place( x = 300, y = 64, width = 100, height = 28 )
# convert unit entry
self.StringConvertUnit = tk.StringVar()
self.EntryConvertUnit = tk.Entry( self.Frame3DPlotParam, textvariable = self.StringConvertUnit )
self.EntryConvertUnit.place( x = 97, y = 96, width = 100, height = 28 )
# sample interval entry
self.StringSampleInterval = tk.StringVar()
self.EntrySampleInterval = tk.Entry( self.Frame3DPlotParam, textvariable = self.StringSampleInterval )
self.EntrySampleInterval.place( x = 300, y = 96, width = 100, height = 28 )
def Init3DPlotButton( self ):
# button for open filedialog
self.Pixel = tk.PhotoImage( width = 1, height = 1 )
self.ButtonOpenFile = tk.Button( self.Frame3DPlot, text = "Open File", image = self.Pixel, background = "#FFFFFF", width = 88, height = 20, compound = "c", command = lambda : self.ButtonUtility.ButtonOpenClick( self.EntryOpenFile ) )
self.ButtonOpenFile.place( x = 2, y = 2 )
# button for loading parameters
self.ButtonLoadParam = tk.Button( self.Frame3DPlot, text = "Load Param", image = self.Pixel, background = "#FFFFFF", width = 88, height = 20, compound = "c" )
self.ButtonLoadParam.config( command = lambda : self.ButtonUtility.ButtonLoadParamClick( self.EntryLoadParam, self.EntryXAxisLower, self.EntryXAxisUpper, self.EntryYAxisLower, self.EntryYAxisUpper, self.EntryZAxisLower, self.EntryZAxisUpper, self.EntryConvertUnit, self.EntrySampleInterval ) )
self.ButtonLoadParam.place( x = 2, y = 34 )
# button for starting to plot
self.ButtonPlot = tk.Button( self.Frame3DPlot, text = "Plot", image = self.Pixel, background = "#FFFFFF", width = 194, height = 20, compound = "c" )
self.ButtonPlot.config( command = lambda : self.ButtonUtility.ButtonPlot( self.StringFilePath.get(), int( self.StringXAxisLower.get() ), int( self.StringXAxisUpper.get() ), int( self.StringYAxisLower.get() ), int( self.StringYAxisUpper.get() ), int( self.StringZAxisLower.get() ), int( self.StringZAxisUpper.get() ), int( self.StringConvertUnit.get() ), int( self.StringSampleInterval.get() ) ) )
self.ButtonPlot.place( x = 2, y = 218 )
# button for closing all figures
self.ButtonCloseAllFigues = tk.Button( self.Frame3DPlot, text = "Close All Figs", image = self.Pixel, background = "#FFFFFF", width = 194, height = 20, compound = "c" )
self.ButtonCloseAllFigues.config( command = lambda : self.ButtonUtility.ButtonCloseAllFigues() )
self.ButtonCloseAllFigues.place( x = 210, y = 218 )
def GuiMainloop( self ):
self.Win.mainloop()
| 46.130719 | 398 | 0.714225 |
e072b0212c9a6a4451611135bd9131ea14e3411b | 8,294 | sql | SQL | D B/db_at.sql | Baboo16cs11/dermowhite | e428bbd3ff3c94e72186259fbee7546264085c45 | [
"MIT"
] | null | null | null | D B/db_at.sql | Baboo16cs11/dermowhite | e428bbd3ff3c94e72186259fbee7546264085c45 | [
"MIT"
] | null | null | null | D B/db_at.sql | Baboo16cs11/dermowhite | e428bbd3ff3c94e72186259fbee7546264085c45 | [
"MIT"
] | null | null | null | /*
SQLyog Community v12.5.1 (64 bit)
MySQL - 5.6.17 : Database - accountechdemo
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`accountechdemo` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `accountechdemo`;
/*Table structure for table `cash` */
DROP TABLE IF EXISTS `cash`;
CREATE TABLE `cash` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`item_id` int(11) NOT NULL,
`cash` varchar(55) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `cash` */
/*Table structure for table `groups` */
DROP TABLE IF EXISTS `groups`;
CREATE TABLE `groups` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`description` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*Data for the table `groups` */
insert into `groups`(`id`,`name`,`description`) values
(1,'admin','Administrator'),
(2,'members','General User');
/*Table structure for table `login_attempts` */
DROP TABLE IF EXISTS `login_attempts`;
CREATE TABLE `login_attempts` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip_address` varchar(45) NOT NULL,
`login` varchar(100) NOT NULL,
`time` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*Data for the table `login_attempts` */
/*Table structure for table `purchase` */
DROP TABLE IF EXISTS `purchase`;
CREATE TABLE `purchase` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`item` varchar(55) DEFAULT NULL,
`value` varchar(55) DEFAULT NULL,
`user` int(11) DEFAULT NULL,
`company` varchar(55) DEFAULT NULL,
`purchaseid` varchar(55) DEFAULT NULL,
`pmethod` varchar(55) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
/*Data for the table `purchase` */
insert into `purchase`(`id`,`item`,`value`,`user`,`company`,`purchaseid`,`pmethod`) values
(20,'mouse','50',1,'hp','1529253970','20'),
(21,'keyboard','50',1,'hp','1529253970','20'),
(22,'mouse','60',1,'dell','1529254023','60'),
(23,'keyboard','70',1,'apple','1529254023','60'),
(24,'mouse','50',1,'hp','1529432374','60'),
(25,'keyboard','50',1,'hp','1529432374','60'),
(27,'lcd','50',1,'hp','1531478342','40'),
(28,'camera','50',1,'hp','1531478366','80'),
(29,'camera','50',1,'hp','1531950291','40'),
(30,'mouse','50',1,'hp','1532514976','40'),
(31,'keyboard','50',1,'hp','1532514976','40'),
(32,'mouse','50',1,'hp','1532514987','40'),
(33,'keyboard','50',1,'hp','1532514987','40'),
(34,'keyboard','50',1,'hp','1532515010','20'),
(35,'mouse','50',1,'hp','1532701121','80'),
(36,'camera','50',1,'hp','1532701121','80'),
(37,'mouse','60',1,'dell','1532701170','40'),
(38,'mouse','50',1,'hp','1532701235','40'),
(39,'keyboard','70',1,'apple','1532701646','60'),
(40,'keyboard','70',1,'apple','1532702041','60');
/*Table structure for table `trail_balance` */
DROP TABLE IF EXISTS `trail_balance`;
CREATE TABLE `trail_balance` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account` varchar(55) DEFAULT NULL,
`opening_balance` varchar(55) DEFAULT NULL,
`debit` varchar(55) DEFAULT NULL,
`credit` varchar(55) DEFAULT NULL,
`closing_balance` varchar(55) DEFAULT NULL,
`opening_year` varchar(55) DEFAULT NULL,
`closing_year` varchar(55) DEFAULT NULL,
`is_asset` binary(1) DEFAULT '0',
`is_share_cap` binary(1) DEFAULT '0',
`is_cash` binary(1) DEFAULT '0',
`is_closing_bal` binary(1) DEFAULT '0',
`is_opening_bal` binary(1) DEFAULT '0',
`is_payable` binary(1) DEFAULT '0',
`is_share_pre` binary(1) DEFAULT '0',
`is_non_cur_liab` binary(1) DEFAULT '0',
`is_ret_earn` binary(1) DEFAULT '0',
`is_liab` binary(1) DEFAULT '0',
`is_expense` binary(1) DEFAULT '0',
`is_income` binary(1) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8;
/*Data for the table `trail_balance` */
insert into `trail_balance`(`id`,`account`,`opening_balance`,`debit`,`credit`,`closing_balance`,`opening_year`,`closing_year`,`is_asset`,`is_share_cap`,`is_cash`,`is_closing_bal`,`is_opening_bal`,`is_payable`,`is_share_pre`,`is_non_cur_liab`,`is_ret_earn`,`is_liab`,`is_expense`,`is_income`) values
(32,'camera','500','150','-','650','2017','2018','1','0','0','0','0','0','0','0','0','0','0','0'),
(33,'keyboard','500','460','-','960','2017','2018','1','0','0','0','0','0','0','0','0','0','0','0'),
(34,'lcd','500','50','-','550','2017','2018','1','0','0','0','0','0','0','0','0','0','0','0'),
(35,'mouse','500','420','-','920','2017','2018','1','0','0','0','0','0','0','0','0','0','0','0'),
(36,'cash','500','-','536','-36','2017','2018','0','0','1','0','0','0','0','0','0','0','0','0'),
(37,'payable','500','-','544','-44','2017','2018','0','0','0','0','0','1','0','0','0','1','0','0'),
(38,'share capital','500','-','-','500','2017','2018','0','1','0','0','0','0','0','0','0','0','0','0'),
(39,'share premium','500','-','-','500','2017','2018','0','1','0','0','0','0','1','0','0','0','0','0'),
(40,'retained earning','400','100','200','500','2017','2018','0','1','0','0','0','0','0','0','1','0','0','0'),
(41,'non_current_liability','500','-','-','500','2017','2018','0','0','0','0','0','0','0','1','0','1','0','0'),
(43,'income','-','','600','600','2017','2018','0','0','0','0','0','0','0','0','0','0','0','1'),
(44,'admin expense','-','50','-','50','2017','2018','0','0','0','0','0','0','0','0','0','0','1','0'),
(45,'material cost','-','375','-','375','2017','2018','0','0','0','0','0','0','0','0','0','0','1','0');
/*Table structure for table `users` */
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip_address` varchar(45) NOT NULL,
`username` varchar(100) DEFAULT NULL,
`password` varchar(255) NOT NULL,
`salt` varchar(255) DEFAULT NULL,
`email` varchar(254) NOT NULL,
`activation_code` varchar(40) DEFAULT NULL,
`forgotten_password_code` varchar(40) DEFAULT NULL,
`forgotten_password_time` int(11) unsigned DEFAULT NULL,
`remember_code` varchar(40) DEFAULT NULL,
`created_on` int(11) unsigned NOT NULL,
`last_login` int(11) unsigned DEFAULT NULL,
`active` tinyint(1) unsigned DEFAULT NULL,
`first_name` varchar(50) DEFAULT NULL,
`last_name` varchar(50) DEFAULT NULL,
`company` varchar(100) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*Data for the table `users` */
insert into `users`(`id`,`ip_address`,`username`,`password`,`salt`,`email`,`activation_code`,`forgotten_password_code`,`forgotten_password_time`,`remember_code`,`created_on`,`last_login`,`active`,`first_name`,`last_name`,`company`,`phone`) values
(1,'127.0.0.1','administrator','$2a$07$SeBknntpZror9uyftVopmu61qg0ms8Qv1yV6FG.kQOSM.9QhmTo36','','admin@admin.com','',NULL,NULL,NULL,1268889823,1532695314,1,'Admin','istrator','ADMIN','0');
/*Table structure for table `users_groups` */
DROP TABLE IF EXISTS `users_groups`;
CREATE TABLE `users_groups` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL,
`group_id` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uc_users_groups` (`user_id`,`group_id`),
KEY `fk_users_groups_users1_idx` (`user_id`),
KEY `fk_users_groups_groups1_idx` (`group_id`),
CONSTRAINT `fk_users_groups_groups1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `fk_users_groups_users1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*Data for the table `users_groups` */
insert into `users_groups`(`id`,`user_id`,`group_id`) values
(1,1,1),
(2,1,2);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
| 40.857143 | 300 | 0.641669 |
1800d0f394a9550e2f272e3c3c2f1d8726e01c7b | 4,484 | go | Go | chaincode/chaincode_example02.go | DXPlus/FabricSDKSamples | 9ced1d87c642f15c60c4fffe2180a8787cd07677 | [
"Apache-2.0"
] | 2 | 2021-07-26T07:02:12.000Z | 2021-07-26T07:19:36.000Z | chaincode/chaincode_example02.go | DXPlus/FabricSDKSamples | 9ced1d87c642f15c60c4fffe2180a8787cd07677 | [
"Apache-2.0"
] | null | null | null | chaincode/chaincode_example02.go | DXPlus/FabricSDKSamples | 9ced1d87c642f15c60c4fffe2180a8787cd07677 | [
"Apache-2.0"
] | 1 | 2021-09-12T12:08:34.000Z | 2021-09-12T12:08:34.000Z | package main
import (
"fmt"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
"strconv"
)
type MyChainCode struct {}
func (t *MyChainCode) Init(stub shim.ChaincodeStubInterface) pb.Response {
fmt.Println("MyChainCode Init")
_, args := stub.GetFunctionAndParameters()
var A, B string // Entities
var Aval, Bval int // Asset holdings
var err error
if len(args) != 4 {
return shim.Error("Incorrect number of arguments. Expecting 4")
}
// Initialize the chaincode
A = args[0]
Aval, err = strconv.Atoi(args[1])
if err != nil {
return shim.Error("Expecting integer value for asset holding")
}
B = args[2]
Bval, err = strconv.Atoi(args[3])
if err != nil {
return shim.Error("Expecting integer value for asset holding")
}
fmt.Printf("Aval = %d, Bval = %d\n", Aval, Bval)
// Write the state to the ledger
err = stub.PutState(A, []byte(strconv.Itoa(Aval)))
if err != nil {
return shim.Error(err.Error())
}
err = stub.PutState(B, []byte(strconv.Itoa(Bval)))
if err != nil {
return shim.Error(err.Error())
}
var as []byte
for _, a := range args {
as = append(as, []byte(a)...)
}
return shim.Success(nil)
}
func (t *MyChainCode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
fmt.Println("MyChainCode Invoke")
function, args := stub.GetFunctionAndParameters()
if function == "query" {
return t.query(stub, args)
} else if function == "transfer" {
return t.transfer(stub, args)
} else if function == "add" {
return t.add(stub, args)
} else if function == "delete" {
return t.delete(stub, args)
} else if function == "setEvent" {
return t.setEvent(stub, args)
}
return shim.Error("Invalid invoke function name. ")
}
func (t *MyChainCode) add(stub shim.ChaincodeStubInterface, args []string) pb.Response{
if len(args) != 2 {
return shim.Error("Incorrect number of arguments. Expecting 2")
}
userName,userBalance := args[0],args[1]
err:= stub.PutState(userName, []byte(userBalance))
if err != nil {
return shim.Error(err.Error())
}
return shim.Success(nil)
}
func (t *MyChainCode) transfer(stub shim.ChaincodeStubInterface, args []string) pb.Response {
var X int // Transaction value
var err error
if len(args) != 3 {
return shim.Error("Incorrect number of arguments. Expecting 3")
}
// Get the Key A and B
A:= args[0]
B:= args[1]
// Get the state from A
AvalBytes, err := stub.GetState(A)
if err != nil {
return shim.Error("Failed to get state")
}
if AvalBytes == nil {
return shim.Error("Entity not found")
}
Aval, _ := strconv.Atoi(string(AvalBytes))//string to int
// Get the state from B
BvalBytes, err := stub.GetState(B)
if err != nil {
return shim.Error("Failed to get state")
}
if BvalBytes == nil {
return shim.Error("Entity not found")
}
Bval, _ := strconv.Atoi(string(BvalBytes))//string to int
// Perform the execution
X, err = strconv.Atoi(args[2])
if err != nil {
return shim.Error("Invalid transaction amount, expecting a integer value")
}
Aval = Aval - X
Bval = Bval + X
// Write the A state
err = stub.PutState(A, []byte(strconv.Itoa(Aval)))
if err != nil {
return shim.Error(err.Error())
}
// Write the B state
err = stub.PutState(B, []byte(strconv.Itoa(Bval)))
if err != nil {
return shim.Error(err.Error())
}
return shim.Success(nil)
}
func (t *MyChainCode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 1 {
return shim.Error("Incorrect number of arguments. Expecting 1")
}
key := args[0]
value , err := stub.GetState(key)
if err != nil {
return shim.Error(err.Error())
}
return shim.Success(value)
}
func (t *MyChainCode) delete(stub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 1 {
return shim.Error("Incorrect number of arguments. Expecting 1")
}
key := args[0]
err := stub.DelState(key)
if err != nil {
return shim.Error(err.Error())
}
return shim.Success(nil)
}
func (t *MyChainCode) setEvent(stub shim.ChaincodeStubInterface, args []string) pb.Response {
if len(args) != 1 {
return shim.Error("Incorrect number of arguments. Expecting 1")
}
payload := args[0]
EventName := "myevent"
if err := stub.SetEvent(EventName, []byte(payload)); err != nil {
return shim.Error(fmt.Errorf("set event: %w", err).Error())
}
return shim.Success(nil)
}
func main() {
err := shim.Start(new(MyChainCode))
if err != nil {
fmt.Printf("Error starting MyChainCode: %s", err)
}
}
| 26.069767 | 93 | 0.674844 |
40401dbe637841f101321cb6a9ced59652e0e913 | 6,463 | py | Python | predict.py | WJ-Lai/NightFusion | 1555692eceb6b85127d21cd43e6fc780b7f91ffd | [
"Apache-2.0"
] | null | null | null | predict.py | WJ-Lai/NightFusion | 1555692eceb6b85127d21cd43e6fc780b7f91ffd | [
"Apache-2.0"
] | 1 | 2019-04-24T12:14:59.000Z | 2019-04-24T12:14:59.000Z | predict.py | WJ-Lai/NightFusion | 1555692eceb6b85127d21cd43e6fc780b7f91ffd | [
"Apache-2.0"
] | null | null | null | """
Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University.
All rights reserved.
Description :
predition
Author:Team Li
"""
import tensorflow as tf
import numpy as np
import cv2
import os
from time import time
from model.factory import model_factory
from dataset.hazy_person import provider
import utils.test_tools as test_tools
from utils.logging import logger
import config
FLAGS = tf.app.flags.FLAGS
slim = tf.contrib.slim
tf.app.flags.DEFINE_string(
'model_name', None,
'The name of the architecture to train.')
tf.app.flags.DEFINE_string(
'attention_module', None,
'The name of attention module to apply.')
tf.app.flags.DEFINE_string(
'checkpoint', None,
'The full file name to a checkpoint from which to fine-tune.')
tf.app.flags.DEFINE_float(
'select_threshold', 0.3, 'obj score less than it would be filter')
tf.app.flags.DEFINE_float(
'nms_threshold', 0.6, 'nms threshold')
tf.app.flags.DEFINE_integer(
'keep_top_k', 30, 'maximun num of obj after nms')
tf.app.flags.DEFINE_integer(
'vis_img_height', 512, 'the img height when visulize')
tf.app.flags.DEFINE_integer(
'vis_img_width', 512, 'the img width when visulize')
#### config only for prioriboxes_mbn ####
tf.app.flags.DEFINE_string(
'backbone_name', None,
'support mobilenet_v1 and mobilenet_v2')
tf.app.flags.DEFINE_boolean(
'multiscale_feats', None,
'whether merge different scale features')
tf.app.flags.DEFINE_boolean(
'whether_aug', None,
'whether use augmentation to prediction')
## define placeholder ##
inputs = tf.placeholder(tf.float32,
shape=(None, config.img_size[0], config.img_size[1], 3))
def build_graph(model_name, attention_module, config_dict, is_training):
"""build tf graph for predict
Args:
model_name: choose a model to build
attention_module: must be "se_block" or "cbam_block"
config_dict: some config for building net
is_training: whether to train or test, here must be False
Return:
det_loss: a tensor with a shape [bs, priori_boxes_num, 4]
clf_loss: a tensor with a shape [bs, priori_boxes_num, 2]
"""
assert is_training == False
net = model_factory(inputs=inputs, model_name=model_name,
attention_module=attention_module, is_training=is_training,
config_dict=config_dict)
corner_bboxes, clf_pred = net.get_output_for_test()
score, bboxes = test_tools.bboxes_select(clf_pred, corner_bboxes,
select_threshold= FLAGS.select_threshold)
score, bboxes = test_tools.bboxes_sort(score, bboxes)
rscores, rbboxes = test_tools.bboxes_nms_batch(score, bboxes,
nms_threshold=FLAGS.nms_threshold,
keep_top_k=FLAGS.keep_top_k)
return rscores, rbboxes
def main(_):
config_dict = {'multiscale_feats': FLAGS.multiscale_feats,
'backbone': FLAGS.backbone_name}
scores, bboxes = build_graph(FLAGS.model_name, FLAGS.attention_module,
config_dict=config_dict, is_training=False)
configuretion = tf.ConfigProto()
configuretion.gpu_options.allow_growth = True
with tf.Session(config=configuretion) as sess:
if FLAGS.checkpoint ==None:
raise ValueError("checkpoint_dir must not be None")
else:
tf.train.Saver().restore(sess, FLAGS.checkpoint)
print("Load checkpoint success...")
pd = provider(batch_size=1, for_what="predict", whether_aug=FLAGS.whether_aug)
logger.info("Please press any key to skip picture...")
while (True):
# start = time()
# norm_imgs, labels, corner_bboxes_gt = pd.load_batch()
norm_imgs, corner_bboxes_gt = pd.load_batch()
#print(corner_bboxes_gt)
imgs = np.uint8((norm_imgs[0] + 1.)*255 / 2)
imgs_for_gt = cv2.resize(imgs, dsize=(FLAGS.vis_img_height, FLAGS.vis_img_width))
imgs_for_pred = imgs_for_gt.copy()
corner_bboxes_gt = corner_bboxes_gt[0]
corner_bboxes_gt[:, 0] = corner_bboxes_gt[:, 0] * FLAGS.vis_img_height
corner_bboxes_gt[:, 1] = corner_bboxes_gt[:, 1] * FLAGS.vis_img_width
corner_bboxes_gt[:, 2] = corner_bboxes_gt[:, 2] * FLAGS.vis_img_height
corner_bboxes_gt[:, 3] = corner_bboxes_gt[:, 3] * FLAGS.vis_img_width
corner_bboxes_gt = np.int32(corner_bboxes_gt)
scores_pred, bboxes_pred = sess.run([scores, bboxes], feed_dict={inputs:np.array(norm_imgs)})
scores_pred = list(scores_pred.values())
bboxes_pred = list(bboxes_pred.values())
scores_pred = scores_pred[0][0]
bboxes_pred = bboxes_pred[0][0]
bboxes_pred[:, 0] = bboxes_pred[:, 0] * FLAGS.vis_img_height
bboxes_pred[:, 1] = bboxes_pred[:, 1] * FLAGS.vis_img_width
bboxes_pred[:, 2] = bboxes_pred[:, 2] * FLAGS.vis_img_height
bboxes_pred[:, 3] = bboxes_pred[:, 3] * FLAGS.vis_img_width
bboxes_pred = np.int32(bboxes_pred)
## vis ##
imgs_for_gt = cv2.cvtColor(imgs_for_gt, cv2.COLOR_BGR2RGB)
imgs_for_pred = cv2.cvtColor(imgs_for_pred, cv2.COLOR_BGR2RGB)
label = np.ones(corner_bboxes_gt.shape[0], dtype=np.int32)
imgs_for_gt = test_tools.visualize_boxes_and_labels_on_image_array(imgs_for_gt, corner_bboxes_gt, label,
None, config.category_index, skip_labels=False)
label = np.ones(bboxes_pred.shape[0], dtype=np.int32)
imgs_for_pred = test_tools.visualize_boxes_and_labels_on_image_array(imgs_for_pred, bboxes_pred, label,
scores_pred, config.category_index,
skip_labels=False)
imgs_for_gt = cv2.cvtColor(imgs_for_gt, cv2.COLOR_RGB2BGR)
imgs_for_pred = cv2.cvtColor(imgs_for_pred, cv2.COLOR_RGB2BGR)
cv2.imshow("ground-truth", imgs_for_gt)
cv2.imshow("prediction", imgs_for_pred)
cv2.waitKey(0)
cv2.destroyAllWindows()
pass
if __name__ == '__main__':
tf.app.run()
| 37.358382 | 118 | 0.640105 |
9099a1b81eeb98274fb68ff3e0585357020262ae | 862 | py | Python | release/stubs.min/Autodesk/Revit/UI/__init___parts/TableViewUIUtils.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 182 | 2017-06-27T02:26:15.000Z | 2022-03-30T18:53:43.000Z | release/stubs.min/Autodesk/Revit/UI/__init___parts/TableViewUIUtils.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 28 | 2017-06-27T13:38:23.000Z | 2022-03-15T11:19:44.000Z | release/stubs.min/Autodesk/Revit/UI/__init___parts/TableViewUIUtils.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 67 | 2017-06-28T09:43:59.000Z | 2022-03-20T21:17:10.000Z | class TableViewUIUtils(object):
""" This utility class contains members that involve the Revit UI and operate on schedule views or MEP electrical panel schedules. """
@staticmethod
def TestCellAndPromptToEditTypeParameter(tableView,sectionType,row,column):
"""
TestCellAndPromptToEditTypeParameter(tableView: TableView,sectionType: SectionType,row: int,column: int) -> bool
Prompts the end-user to control whether a type parameter contained in the
specified table cell should be allowed edited.
tableView: The table view.
sectionType: The section the row lies in.
row: The row index in the section.
column: The column index in the section.
Returns: Returns true if editing the cell is allowed; otherwise false.
"""
pass
__all__=[
'TestCellAndPromptToEditTypeParameter',
]
| 26.121212 | 136 | 0.723898 |
b85045e3a24beae6597253193696370d3ddfb0df | 71,980 | sql | SQL | database_backup.sql | Onionator/freelance_project | b39a1bd945319f08241f47b023d488e2bd021cb4 | [
"MIT"
] | null | null | null | database_backup.sql | Onionator/freelance_project | b39a1bd945319f08241f47b023d488e2bd021cb4 | [
"MIT"
] | 7 | 2020-02-26T00:53:17.000Z | 2022-02-26T05:25:35.000Z | database_backup.sql | Onionator/freelance_project | b39a1bd945319f08241f47b023d488e2bd021cb4 | [
"MIT"
] | 1 | 2019-08-13T21:27:43.000Z | 2019-08-13T21:27:43.000Z | --
-- PostgreSQL database dump
--
-- Dumped from database version 11.4
-- Dumped by pg_dump version 11.4
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: Sam
--
CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE public.ar_internal_metadata OWNER TO "Sam";
--
-- Name: products; Type: TABLE; Schema: public; Owner: Sam
--
CREATE TABLE public.products (
id bigint NOT NULL,
name character varying,
cost double precision,
country_of_origin character varying
);
ALTER TABLE public.products OWNER TO "Sam";
--
-- Name: products_id_seq; Type: SEQUENCE; Schema: public; Owner: Sam
--
CREATE SEQUENCE public.products_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.products_id_seq OWNER TO "Sam";
--
-- Name: products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: Sam
--
ALTER SEQUENCE public.products_id_seq OWNED BY public.products.id;
--
-- Name: reviews; Type: TABLE; Schema: public; Owner: Sam
--
CREATE TABLE public.reviews (
id bigint NOT NULL,
author character varying,
content_body character varying,
rating integer,
product_id integer
);
ALTER TABLE public.reviews OWNER TO "Sam";
--
-- Name: reviews_id_seq; Type: SEQUENCE; Schema: public; Owner: Sam
--
CREATE SEQUENCE public.reviews_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.reviews_id_seq OWNER TO "Sam";
--
-- Name: reviews_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: Sam
--
ALTER SEQUENCE public.reviews_id_seq OWNED BY public.reviews.id;
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: Sam
--
CREATE TABLE public.schema_migrations (
version character varying NOT NULL
);
ALTER TABLE public.schema_migrations OWNER TO "Sam";
--
-- Name: products id; Type: DEFAULT; Schema: public; Owner: Sam
--
ALTER TABLE ONLY public.products ALTER COLUMN id SET DEFAULT nextval('public.products_id_seq'::regclass);
--
-- Name: reviews id; Type: DEFAULT; Schema: public; Owner: Sam
--
ALTER TABLE ONLY public.reviews ALTER COLUMN id SET DEFAULT nextval('public.reviews_id_seq'::regclass);
--
-- Data for Name: ar_internal_metadata; Type: TABLE DATA; Schema: public; Owner: Sam
--
COPY public.ar_internal_metadata (key, value, created_at, updated_at) FROM stdin;
environment development 2019-08-09 16:01:18.876739 2019-08-09 16:01:18.876739
\.
--
-- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: Sam
--
COPY public.products (id, name, cost, country_of_origin) FROM stdin;
244 Pizza 6.84999999999999964 Mali
245 French Toast 9.1899999999999995 Congo
246 French Toast 4.96999999999999975 Montserrat
247 Chicken Parm 18.9899999999999984 Monaco
248 Stinky Tofu 3.75999999999999979 Seychelles
249 California Maki 15.3499999999999996 Saudi Arabia
250 Pasta And Beans 18.6099999999999994 Antigua and Barbuda
251 Chicken Milanese 8.77999999999999936 Suriname
252 Chicken Fajitas 12.6999999999999993 Congo
253 Sushi 10.0099999999999998 Dominica
254 Sushi 13.5899999999999999 Tonga
255 Teriyaki Chicken Donburi 17.8000000000000007 Philippines
256 Chicken Milanese 2 Georgia
257 California Maki 19 Nigeria
258 Stinky Tofu 7.74000000000000021 Haiti
259 Fettuccine Alfredo 19.8599999999999994 Uruguay
260 Meatballs With Sauce 16.6000000000000014 Montenegro
261 Chicken Milanese 8.30000000000000071 Netherlands
262 Teriyaki Chicken Donburi 6.24000000000000021 Saint Barthelemy
263 Scotch Eggs 12.1099999999999994 South Georgia and the South Sandwich Islands
264 Pasta With Tomato And Basil 8.16000000000000014 British Indian Ocean Territory (Chagos Archipelago)
265 Pork Belly Buns 3.16999999999999993 Equatorial Guinea
266 Bruschette With Tomato 16.6999999999999993 Haiti
267 Cheeseburger 15.9499999999999993 Cook Islands
268 Chicken Milanese 12.2400000000000002 Iraq
269 Cauliflower Penne 15.6600000000000001 Niger
270 Vegetable Soup 15.4800000000000004 Bosnia and Herzegovina
271 Souvlaki 1.6399999999999999 Monaco
272 Som Tam 14.25 Maldives
273 Pizza 13.0800000000000001 Mongolia
274 Kebab 12.0299999999999994 Hong Kong
275 California Maki 19.0500000000000007 Macao
276 Bunny Chow 15.4000000000000004 Cameroon
277 Meatballs With Sauce 16.4299999999999997 Faroe Islands
278 Salmon Nigiri 9.91000000000000014 Taiwan
279 Meatballs With Sauce 3.39000000000000012 Gabon
280 Barbecue Ribs 19.5599999999999987 Belize
281 Peking Duck 5.45999999999999996 Bosnia and Herzegovina
282 Hummus 12.6600000000000001 Monaco
283 Pasta With Tomato And Basil 16.9400000000000013 Malaysia
284 Meatballs With Sauce 17.9800000000000004 Portugal
285 Pasta With Tomato And Basil 13.2699999999999996 Martinique
286 Arepas 15.8699999999999992 Mali
287 Linguine With Clams 17.4299999999999997 Zimbabwe
288 French Fries With Sausages 3.45999999999999996 Serbia
289 Pho 3.0299999999999998 Dominican Republic
290 Chicken Wings 8.11999999999999922 Aruba
291 Poke 7.80999999999999961 Angola
292 Stinky Tofu 2.68999999999999995 Guatemala
293 Pasta Carbonara 16.0100000000000016 Haiti
\.
--
-- Data for Name: reviews; Type: TABLE DATA; Schema: public; Owner: Sam
--
COPY public.reviews (id, author, content_body, rating, product_id) FROM stdin;
1722 Gloria Go out on a Tuesday? Who am I, Charlie Sheen? Non qui quae. Non quod omnis. Repellendus suscipit voluptatem. 1 244
1723 Helen Lovejoy That's it! You people have stood in my way long enough. I'm going to clown college! Accusamus ea vel. Nisi fuga dignissimos. Consequatur consequuntur sed. 3 244
1724 Homer Simpson You tried your best and you failed miserably. The lesson is: Never try. Impedit aut ipsam. Suscipit commodi nesciunt. Voluptatum magni ut. 4 244
1725 Krusty the Clown Life is just one crushing defeat after another until you just wish Flanders was dead. Hic et et. Ut quis animi. Sunt voluptatum sed. 1 244
1726 Lois Pennycandy Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Error aut repudiandae. Eos quidem ullam. Non qui assumenda. 1 244
1727 Krusty the Clown D'oh! Aperiam quo commodi. Rerum et mollitia. Cumque nihil asperiores. 1 245
1728 Rabbi Hyman Krustofski To alcohol! The cause of, and solution to, all of life's problems. Vel sunt dolores. Voluptas aut dicta. Ipsum qui officia. 1 245
1729 Chief Clancy Wiggum D'oh! Deleniti officia et. Ratione explicabo nihil. Et molestias sint. 1 245
1730 Sarah Wiggum Go out on a Tuesday? Who am I, Charlie Sheen? Nostrum quaerat hic. Dolorum quia nulla. Ullam voluptas a. 1 245
1731 Dr. Julius Hibbert Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Ipsam nihil laudantium. Voluptates quia deserunt. Voluptatum inventore quis. 1 245
1732 Richard It takes two to lie: one to lie and one to listen. Et provident amet. Occaecati quo sit. Doloribus libero corrupti. 1 245
1733 Dr. Nick Riviera If you pray to the wrong god, you might just make the right one madder and madder. Eveniet voluptatem inventore. Vero aut debitis. Beatae fugiat modi. 4 245
1734 Crazy Cat Lady It takes two to lie: one to lie and one to listen. Accusamus corporis earum. Eos sit quisquam. Quasi rerum sapiente. 2 245
1735 Ruth Powers D'oh! Id aut possimus. Quia et exercitationem. Occaecati voluptate est. 3 245
1736 Yes Guy I'm not normally a praying man, but if you're up there, please save me, Superman! Adipisci a laboriosam. Dolor adipisci animi. Aut voluptatem doloribus. 3 246
1737 Dr. Julius Hibbert I'm not normally a praying man, but if you're up there, please save me, Superman! Fugit maxime inventore. Nihil veniam sed. Et ducimus sed. 3 246
1738 Lunchlady Doris Marriage is like a coffin and each kid is another nail. Ullam aliquid autem. Sint nihil qui. Et temporibus vero. 2 246
1739 Janey Powell Kill my boss? Do I dare live out the American dream? Tempora odio sunt. Qui non amet. Ex saepe dolores. 3 246
1740 Manjula Nahasapeemapetilon Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Omnis alias saepe. Et harum qui. Est ea est. 3 246
1741 Kang Sorry, Mom, the mob has spoken. Facere nesciunt qui. Iste laboriosam mollitia. Vitae excepturi impedit. 4 246
1742 Grampa Abraham Simpson Life is just one crushing defeat after another until you just wish Flanders was dead. Non cum eveniet. Voluptatibus placeat sit. Accusamus velit odio. 4 246
1743 Gloria I'm not normally a praying man, but if you're up there, please save me, Superman! Consequatur debitis eos. Soluta voluptate facilis. Minus eligendi vitae. 4 246
1744 Judge Constance Harm Kill my boss? Do I dare live out the American dream? Excepturi corporis unde. Aut aut aliquid. Esse quas pariatur. 4 246
1745 Lenny Leonard Cheating is the gift man gives himself. Aut error perspiciatis. Beatae fugiat velit. Laboriosam rem natus. 2 246
1746 Ralph Wiggum Life is just one crushing defeat after another until you just wish Flanders was dead. Consequuntur quibusdam amet. Delectus aut omnis. Et unde sed. 2 246
1747 The Rich Texan When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Tempore tenetur cum. Sit eum ut. Repellendus qui quibusdam. 1 247
1748 Lois Pennycandy That's it! You people have stood in my way long enough. I'm going to clown college! Sint est est. Sed impedit quidem. Necessitatibus qui praesentium. 1 247
1749 Jasper Beardly Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Error labore autem. Repellat corrupti autem. Laborum dolorem fugit. 1 247
1750 Gary Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Nesciunt qui sint. Occaecati commodi aut. Reprehenderit facilis culpa. 1 247
1751 Terri Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Officiis debitis alias. Vero deleniti quia. Quo hic sunt. 1 248
1752 Bernice Hibbert Sorry, Mom, the mob has spoken. Quo voluptatum velit. Laudantium harum ut. Magni dignissimos ex. 2 248
1753 Old Barber D'oh! Corrupti et itaque. Accusamus voluptas minus. Explicabo dolorum pariatur. 1 248
1754 Grampa Abraham Simpson Sorry, Mom, the mob has spoken. Et qui sed. Maxime vel adipisci. Consectetur dolor nemo. 2 248
1755 Boobarella It takes two to lie: one to lie and one to listen. Quo minus magnam. Consequuntur aut similique. Eius et incidunt. 2 248
1756 Leopold Cheating is the gift man gives himself. Necessitatibus nulla id. Sunt a doloremque. Saepe ut nihil. 4 248
1757 Old Barber Sorry, Mom, the mob has spoken. Quaerat rerum quibusdam. Sed doloremque nihil. Provident vel nihil. 1 248
1758 Terri What’s the point of going out? We’re just gonna wind up back home anyway. Magnam et fugit. Quaerat quibusdam ducimus. Quia perspiciatis nostrum. 1 248
1759 Johnny Tightlips Cheating is the gift man gives himself. Aut et quos. Nemo dolores ad. Corporis velit maiores. 3 248
1760 Homer Simpson Sorry, Mom, the mob has spoken. Placeat et ut. Ut vero sequi. Beatae aut aliquid. 4 248
1761 Lurleen Lumpkin Trust me, Bart, it's better to walk in on both your parents than on just one of them. Velit eius occaecati. Veritatis omnis saepe. Cupiditate qui amet. 1 248
1762 Kodos Marriage is like a coffin and each kid is another nail. Placeat dolorem cum. Voluptatem sit qui. Rem sapiente temporibus. 4 248
1763 Akira Go out on a Tuesday? Who am I, Charlie Sheen? Qui quia sit. Reprehenderit voluptatem rerum. Ut aut hic. 3 249
1764 Troy McClure Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Libero quas voluptates. Modi quibusdam accusantium. Sunt error eveniet. 3 249
1765 Ernst Sorry, Mom, the mob has spoken. Architecto ut voluptatum. Voluptatem quos voluptate. Dolorem iure excepturi. 4 249
1766 Principal Seymour Skinner Kill my boss? Do I dare live out the American dream? Sit voluptas et. Et qui quisquam. Sit maxime occaecati. 2 250
1767 Roger Meyers, Jr. What’s the point of going out? We’re just gonna wind up back home anyway. Placeat molestiae distinctio. Et commodi officiis. Rerum sint ipsam. 2 250
1768 Charles Montgomery Burns To alcohol! The cause of, and solution to, all of life's problems. Vitae ducimus repudiandae. Tempore consequuntur velit. Nemo voluptas sed. 1 250
1769 Gary Go out on a Tuesday? Who am I, Charlie Sheen? Nobis non vel. Officia perspiciatis qui. Et sunt velit. 3 250
1770 Allison Taylor When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Est ipsam accusantium. Aliquid pariatur quia. Ut ullam nisi. 2 250
1771 The Rich Texan D'oh! Perspiciatis quia aut. Deserunt quos quam. Illo dolore vero. 4 250
1772 Aristotle Amadopolis I'm not normally a praying man, but if you're up there, please save me, Superman! Fuga quae reprehenderit. Illum cum dicta. Consequatur ut eos. 1 250
1773 Leopold To alcohol! The cause of, and solution to, all of life's problems. At delectus dolor. Quaerat eaque atque. Eaque tenetur nostrum. 2 250
1774 Selma Bouvier To alcohol! The cause of, and solution to, all of life's problems. Reiciendis delectus natus. Maxime qui ipsa. Aut nostrum sunt. 4 250
1775 Cletus Spuckler Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Reprehenderit voluptas in. Officia iure tempora. Et quia veniam. 4 250
1776 Ugolin Oh, loneliness and cheeseburgers are a dangerous mix. Asperiores quia ducimus. Eos molestiae eveniet. Quia voluptas qui. 4 250
1777 Ned Flanders To alcohol! The cause of, and solution to, all of life's problems. Consequatur quia temporibus. Ratione id laudantium. Ratione tenetur voluptas. 2 250
1778 Chase Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Molestiae quaerat sint. Aliquid voluptatem magnam. Aut ab doloribus. 4 251
1779 Wiseguy It takes two to lie: one to lie and one to listen. Voluptas dolorem consectetur. Voluptas aliquid qui. Sunt sapiente consequatur. 2 251
1780 Coach Lugash It takes two to lie: one to lie and one to listen. Debitis deserunt aut. Dignissimos doloremque dolorum. Voluptatibus saepe ipsa. 1 251
1781 Lenny Leonard Life is just one crushing defeat after another until you just wish Flanders was dead. Expedita ipsum ea. Iusto deleniti dolor. Inventore numquam et. 1 251
1782 Mona Simpson Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Voluptatem sint amet. Laborum quis quasi. Incidunt dolorum fugiat. 2 251
1783 Dave Shutton If you pray to the wrong god, you might just make the right one madder and madder. Beatae enim voluptatem. Cumque et sit. Nulla possimus magni. 4 251
1784 Principal Seymour Skinner What’s the point of going out? We’re just gonna wind up back home anyway. Voluptas explicabo ipsam. Voluptatem illo eius. Dignissimos vitae est. 3 251
1785 Captain Horatio McCallister Sorry, Mom, the mob has spoken. Ad quos eum. Doloribus atque quibusdam. Excepturi nesciunt expedita. 3 251
1786 Wendell Borton To alcohol! The cause of, and solution to, all of life's problems. Esse consequatur sunt. Quia sunt dolores. Nesciunt aspernatur nostrum. 1 251
1787 Sideshow Bob You tried your best and you failed miserably. The lesson is: Never try. Aut quis aut. Nihil aut sed. Libero ut nisi. 2 252
1788 Krusty the Clown Kill my boss? Do I dare live out the American dream? Libero provident ipsam. Tempore sit dolore. Vel eum et. 4 252
1789 Dr. Julius Hibbert Cheating is the gift man gives himself. Nulla autem qui. Recusandae vel tempora. Ut ea dolores. 3 252
1790 Nelson Muntz What’s the point of going out? We’re just gonna wind up back home anyway. Nam officiis id. Provident maxime delectus. Rerum qui dignissimos. 1 252
1791 Kodos Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Autem aliquam rerum. Aperiam placeat quod. Qui aperiam ipsa. 3 252
1792 Waylon Smithers I'm not normally a praying man, but if you're up there, please save me, Superman! Maiores rem voluptates. Et officiis exercitationem. Harum aut earum. 4 252
1793 Jacqueline Bouvier I'm not normally a praying man, but if you're up there, please save me, Superman! Ipsa unde officia. Id consequatur eos. Occaecati sit modi. 4 252
1794 Rabbi Hyman Krustofski D'oh! Officia nostrum possimus. Vel deserunt saepe. Sed rerum sequi. 4 252
1795 Lionel Hutz That's it! You people have stood in my way long enough. I'm going to clown college! Est assumenda minima. Illo sint et. Optio est totam. 3 252
1796 Drederick Tatum You tried your best and you failed miserably. The lesson is: Never try. Laboriosam in omnis. Officiis beatae quibusdam. Beatae eum tenetur. 1 252
1797 Gil Gunderson Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. At debitis laboriosam. Aut soluta qui. Quo ipsum aut. 3 252
1798 Jacques When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Aut quis rerum. Corrupti et accusantium. Nam ullam quia. 2 253
1799 Johnny Tightlips You tried your best and you failed miserably. The lesson is: Never try. Quaerat ab nemo. Similique eligendi commodi. Omnis nisi eius. 4 253
1800 Crazy Cat Lady What’s the point of going out? We’re just gonna wind up back home anyway. Esse qui et. Unde deleniti et. Eos vel officia. 4 253
1801 Lou To alcohol! The cause of, and solution to, all of life's problems. Doloremque et tempore. Est odit impedit. Dolores accusantium nihil. 1 253
1802 Ernst When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Aut distinctio est. Omnis aut fugit. Ut error reiciendis. 4 253
1803 Herbert Powell When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Cum consequatur qui. Ipsum est est. In occaecati quisquam. 2 253
1804 Ruth Powers D'oh! Quo in qui. Animi velit perferendis. Repudiandae modi temporibus. 2 253
1805 Kent Brockman Kill my boss? Do I dare live out the American dream? Voluptatem voluptatem assumenda. Nemo voluptatum laborum. Id vero animi. 4 253
1806 Cesar Trust me, Bart, it's better to walk in on both your parents than on just one of them. Eum fugiat rerum. Sunt est et. Ut odio aut. 2 253
1807 Cesar I'm not normally a praying man, but if you're up there, please save me, Superman! Est enim suscipit. Quaerat vero aspernatur. Animi repellendus sapiente. 2 253
1808 Cecil Terwilliger Marriage is like a coffin and each kid is another nail. Veritatis perferendis tenetur. Et laudantium error. Deserunt blanditiis consequuntur. 2 254
1809 Jebediah Springfield Kill my boss? Do I dare live out the American dream? Beatae ipsa consequatur. Sint quae aperiam. Non amet eos. 2 254
1810 Amber Simpson To alcohol! The cause of, and solution to, all of life's problems. Itaque a soluta. Eveniet ipsa voluptate. Quasi non explicabo. 3 254
1811 Eddie Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Labore cum repellendus. Quia est numquam. A laborum quam. 2 254
1812 Chief Clancy Wiggum When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Est voluptate nemo. Consequatur minus repellendus. Ea dolor consectetur. 4 254
1813 Atkins, State Comptroller Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Doloremque sint ipsa. Quaerat explicabo atque. Veniam error quaerat. 3 254
1814 Snowball Marriage is like a coffin and each kid is another nail. Veniam sit consequatur. Incidunt nisi esse. Eaque dolores ipsa. 4 255
1815 Terri It takes two to lie: one to lie and one to listen. Magni quos enim. Non et dicta. Aspernatur rerum officia. 1 255
1816 Gloria You tried your best and you failed miserably. The lesson is: Never try. Iusto corrupti quod. Ut totam et. Reprehenderit id quae. 4 255
1817 Atkins, State Comptroller What’s the point of going out? We’re just gonna wind up back home anyway. Voluptatem ut praesentium. Dolor ab occaecati. Error voluptatem consequatur. 4 255
1818 Herbert Powell Marriage is like a coffin and each kid is another nail. Ex veniam fuga. Aut ducimus fuga. Provident eligendi rem. 1 255
1819 Ruth Powers Cheating is the gift man gives himself. Molestias voluptas nemo. Nesciunt eius est. Rerum facere earum. 2 255
1820 Kearney Zzyzwicz Jr. It takes two to lie: one to lie and one to listen. Iste molestiae nostrum. Minima quasi sit. Vitae aut rerum. 1 256
1821 Nelson Muntz Life is just one crushing defeat after another until you just wish Flanders was dead. Deserunt aut vel. Ipsa omnis unde. Ratione pariatur laborum. 2 256
1822 Dr. Velimirovic Oh, loneliness and cheeseburgers are a dangerous mix. Sed reiciendis aut. Optio modi velit. Sit sunt commodi. 2 256
1823 Gary Kill my boss? Do I dare live out the American dream? Aut in dignissimos. Deleniti impedit a. Incidunt natus iste. 4 256
1824 Frankie the Squealer Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Sed adipisci natus. Totam quo eum. Aperiam quia dolorem. 3 256
1825 Charles Montgomery Burns That's it! You people have stood in my way long enough. I'm going to clown college! Similique eos officia. Et non et. Sit qui expedita. 3 256
1826 Aristotle Amadopolis Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Et autem aut. Quo voluptatem natus. Nam libero neque. 4 256
1827 Captain Horatio McCallister Kill my boss? Do I dare live out the American dream? Odit cum voluptatem. Voluptatem magnam aspernatur. Laudantium similique quia. 3 256
1828 Roger Meyers, Jr. Marriage is like a coffin and each kid is another nail. Ab nesciunt est. Odit rem consequatur. Reiciendis facere sapiente. 2 256
1829 Superintendent Gary Chalmers Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Optio molestiae quisquam. Deserunt iusto dolores. Quas voluptas velit. 2 256
1830 Reverend Timothy Lovejoy If you pray to the wrong god, you might just make the right one madder and madder. Soluta at quisquam. Possimus vel et. Aliquam harum dolore. 3 256
1831 Princess Kashmir What’s the point of going out? We’re just gonna wind up back home anyway. Quia aut ducimus. Facere et rem. Voluptas omnis cupiditate. 2 257
1832 Chase Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Dolore deleniti fugiat. Qui aperiam placeat. Maiores sapiente tempore. 1 257
1833 Ralph Wiggum Trust me, Bart, it's better to walk in on both your parents than on just one of them. Occaecati culpa quaerat. Eligendi ut ut. Possimus magni odio. 4 257
1834 Bernice Hibbert You tried your best and you failed miserably. The lesson is: Never try. Nulla optio soluta. Neque totam ea. Sed autem expedita. 2 257
1835 Benjamin Trust me, Bart, it's better to walk in on both your parents than on just one of them. Quibusdam est perspiciatis. Fugiat et expedita. Deleniti quo sit. 2 257
1836 The Rich Texan That's it! You people have stood in my way long enough. I'm going to clown college! Doloremque dignissimos nam. Recusandae qui explicabo. Fuga inventore recusandae. 2 257
1837 Dr. Julius Hibbert Trust me, Bart, it's better to walk in on both your parents than on just one of them. Optio deserunt sed. Libero optio ut. Et iste sed. 2 257
1838 Marty When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Officia esse rerum. Voluptate quae architecto. In architecto doloribus. 1 257
1839 Amber Simpson To alcohol! The cause of, and solution to, all of life's problems. Ducimus ea alias. Quos voluptate repudiandae. Qui quae qui. 3 257
1840 Gil Gunderson Cheating is the gift man gives himself. Enim quia similique. A vero et. Qui temporibus autem. 2 258
1841 Jasper Beardly It takes two to lie: one to lie and one to listen. Nostrum eius et. Cupiditate quo nulla. Rerum placeat error. 3 258
1842 Moe Szyslak Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Consequatur ullam consequatur. Corporis enim quos. Quibusdam labore unde. 4 258
1843 Terri Life is just one crushing defeat after another until you just wish Flanders was dead. Nobis commodi aut. Sed eos impedit. Atque ut doloremque. 1 258
1844 Terri I'm not normally a praying man, but if you're up there, please save me, Superman! Dolores et est. Fuga iste exercitationem. Ex error non. 2 259
1845 Herbert Powell Marriage is like a coffin and each kid is another nail. Exercitationem saepe porro. Sit reiciendis tempore. Voluptas est accusantium. 3 259
1846 Arnie Pye Go out on a Tuesday? Who am I, Charlie Sheen? Est mollitia eius. Sed adipisci nesciunt. Facere cumque blanditiis. 1 259
1847 Squeaky-Voiced Teen Go out on a Tuesday? Who am I, Charlie Sheen? Quis quis ex. Vero quidem consequatur. Laboriosam consequuntur modi. 2 259
1848 Jacques What’s the point of going out? We’re just gonna wind up back home anyway. Nisi quia sed. Deleniti adipisci minima. Accusamus eos tempore. 3 259
1849 Herbert Powell Life is just one crushing defeat after another until you just wish Flanders was dead. Repellendus quod sit. Qui et nostrum. Consequatur minima accusamus. 4 259
1850 Gino To alcohol! The cause of, and solution to, all of life's problems. Esse sequi doloremque. Dolorem quia magnam. Est repellendus cupiditate. 1 259
1851 Dr. Nick Riviera What’s the point of going out? We’re just gonna wind up back home anyway. Sint qui asperiores. Nostrum et et. Exercitationem quia in. 3 259
1852 Akira Cheating is the gift man gives himself. Laboriosam sunt tenetur. Totam dolorem dolor. Corporis architecto fugiat. 1 259
1853 Crazy Cat Lady Life is just one crushing defeat after another until you just wish Flanders was dead. Tenetur voluptatem quisquam. Delectus cum excepturi. Totam ut nostrum. 2 259
1854 Charles Montgomery Burns Life is just one crushing defeat after another until you just wish Flanders was dead. Fugiat omnis cupiditate. Pariatur delectus dolor. Qui quas eum. 2 259
1855 Baby Gerald Oh, loneliness and cheeseburgers are a dangerous mix. Impedit molestiae voluptates. Officiis est odit. Eos deserunt non. 4 259
1856 Superintendent Gary Chalmers Sorry, Mom, the mob has spoken. Dolorem qui magni. Eius et a. Qui consequatur tenetur. 2 260
1857 Lisa Simpson You tried your best and you failed miserably. The lesson is: Never try. Commodi ipsam et. Sapiente quisquam provident. Ducimus omnis consequatur. 3 260
1858 Edna Krabappel Go out on a Tuesday? Who am I, Charlie Sheen? Illum voluptatem nisi. Dolorem voluptatem repellat. Tempora ut ullam. 3 260
1859 Johnny Tightlips When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Consequatur itaque voluptatum. Aliquid eos sunt. Ipsum eaque maxime. 3 260
1860 Sherri That's it! You people have stood in my way long enough. I'm going to clown college! Nemo non dolor. Voluptatem sit aut. Harum iure quibusdam. 1 261
1861 Allison Taylor Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Vitae quia quia. Atque rerum et. Omnis totam vero. 3 261
1862 Patches Violet When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Aut et saepe. Iusto similique sit. Pariatur quaerat aperiam. 3 261
1863 Legs Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Sint alias et. Adipisci sit quas. Quisquam voluptatem consequatur. 4 261
1864 Sideshow Bob Life is just one crushing defeat after another until you just wish Flanders was dead. Ipsam tenetur iure. Explicabo consequuntur quibusdam. Cum recusandae distinctio. 2 261
1865 Dave Shutton Oh, loneliness and cheeseburgers are a dangerous mix. Ipsam inventore amet. Debitis voluptas ipsa. Officiis modi deserunt. 2 261
1866 Martin Prince I'm not normally a praying man, but if you're up there, please save me, Superman! Et facere praesentium. Et beatae eligendi. Sit accusantium aut. 4 261
1867 Artie Ziff Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Accusamus id enim. Labore odio sapiente. Aut cupiditate incidunt. 4 261
1868 Dr. Velimirovic I'm not normally a praying man, but if you're up there, please save me, Superman! Et sit aliquid. Alias iusto porro. Eum quia nobis. 2 261
1869 Dr. Marvin Monroe Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Accusamus rem illum. Non atque deserunt. Incidunt qui ratione. 3 261
1870 Carl Carlson Trust me, Bart, it's better to walk in on both your parents than on just one of them. Quia magni culpa. Eveniet illo eaque. Et quidem et. 2 261
1871 Bumblebee Man To alcohol! The cause of, and solution to, all of life's problems. Ipsum soluta distinctio. Nemo quia nulla. Quo sed est. 4 261
1872 Eddie Life is just one crushing defeat after another until you just wish Flanders was dead. Et architecto veritatis. Officia qui quia. Quia illo iusto. 4 262
1873 Lunchlady Doris Life is just one crushing defeat after another until you just wish Flanders was dead. Quis eum quia. Modi cum expedita. Quisquam debitis officia. 2 262
1874 Cookie Kwan Trust me, Bart, it's better to walk in on both your parents than on just one of them. Mollitia cupiditate quia. Nisi necessitatibus est. Laudantium placeat repellendus. 4 262
1875 Herbert Powell Cheating is the gift man gives himself. Aut architecto officiis. Officiis quam enim. Ipsum quod et. 1 262
1876 Lindsey Naegle I'm not normally a praying man, but if you're up there, please save me, Superman! Et quia autem. Sit autem voluptates. Consequatur laboriosam quas. 1 262
1877 Gloria It takes two to lie: one to lie and one to listen. Praesentium qui est. Aliquam libero quod. Qui necessitatibus ut. 3 262
1878 Birchibald "Birch" T. Barlow D'oh! Quis et et. Quasi dolorum facilis. Fugit voluptatem magni. 2 262
1879 Radioactive Man To alcohol! The cause of, and solution to, all of life's problems. Officiis adipisci quos. Debitis eos culpa. Qui nihil nemo. 3 262
1880 Jacques Trust me, Bart, it's better to walk in on both your parents than on just one of them. Voluptatibus quam voluptatum. Eius numquam non. Omnis dolore mollitia. 1 262
1881 Judge Roy Snyder D'oh! Voluptas facere ea. Officiis qui deleniti. Exercitationem eos eligendi. 1 263
1882 Dave Shutton Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Et assumenda dolorum. Blanditiis in dolores. Enim dolores consequuntur. 1 263
1883 Reverend Timothy Lovejoy Trust me, Bart, it's better to walk in on both your parents than on just one of them. Quidem labore possimus. Iusto exercitationem harum. Sit et suscipit. 3 263
1884 Nelson Muntz Trust me, Bart, it's better to walk in on both your parents than on just one of them. Et ut nemo. Laboriosam facilis qui. Eum quos omnis. 3 263
1885 Disco Stu Trust me, Bart, it's better to walk in on both your parents than on just one of them. Ex nesciunt architecto. Et id perferendis. Molestias et quia. 3 263
1886 Gunter Cheating is the gift man gives himself. Unde quo aut. Et incidunt consequuntur. Consequuntur voluptatem dolorem. 4 263
1887 Jimbo Jones You tried your best and you failed miserably. The lesson is: Never try. Quia vero non. Explicabo quo qui. Quas dolorem et. 3 263
1888 Dr. J. Loren Pryor Kill my boss? Do I dare live out the American dream? Eius doloribus eum. Et reprehenderit minus. Tempora excepturi iusto. 4 263
1889 Bart Simpson Life is just one crushing defeat after another until you just wish Flanders was dead. Et debitis voluptatem. Quaerat esse sequi. Illo id sed. 4 263
1890 Disco Stu When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Et porro in. Officia cupiditate voluptatem. Sit molestiae porro. 1 263
1891 Birchibald "Birch" T. Barlow Oh, loneliness and cheeseburgers are a dangerous mix. Provident accusantium voluptatum. Et laboriosam et. Maiores natus voluptatibus. 2 264
1892 Todd Flanders To alcohol! The cause of, and solution to, all of life's problems. Sed vero aspernatur. Ea unde quisquam. Itaque hic vel. 2 264
1893 Elizabeth Hoover To alcohol! The cause of, and solution to, all of life's problems. Illo sint odit. Et necessitatibus quibusdam. Enim autem inventore. 2 264
1894 Mrs. Glick Go out on a Tuesday? Who am I, Charlie Sheen? Dolores adipisci dolor. Error eveniet exercitationem. Totam tempora voluptatem. 2 264
1895 Marge Simpson I'm not normally a praying man, but if you're up there, please save me, Superman! Aut laudantium est. Unde nam temporibus. Voluptate et id. 1 264
1896 Jacques Trust me, Bart, it's better to walk in on both your parents than on just one of them. Eos ad sed. Cupiditate nostrum vel. Odio omnis dolores. 1 264
1897 Mayor "Diamond Joe" Quimby You tried your best and you failed miserably. The lesson is: Never try. Est qui itaque. Error dolores in. Quia quo maiores. 2 264
1898 Disco Stu What’s the point of going out? We’re just gonna wind up back home anyway. Vitae eaque ipsam. Cupiditate sunt dolorem. Aliquid pariatur qui. 2 264
1899 Charles Montgomery Burns To alcohol! The cause of, and solution to, all of life's problems. Suscipit aut reiciendis. Et velit vel. Ea ea exercitationem. 4 264
1900 Bart Simpson It takes two to lie: one to lie and one to listen. Asperiores voluptas unde. Dicta reiciendis iusto. Voluptas veritatis cumque. 1 264
1901 Poor Violet Oh, loneliness and cheeseburgers are a dangerous mix. Id consequuntur est. Maxime non odit. Dolore accusamus facere. 2 265
1902 Cletus Spuckler Kill my boss? Do I dare live out the American dream? Cumque dolor et. Nihil nam qui. Blanditiis mollitia quod. 2 265
1903 Captain Lance Murdock Kill my boss? Do I dare live out the American dream? Consequatur ullam dolores. Perspiciatis saepe repudiandae. Officia rerum et. 2 265
1904 Cesar Trust me, Bart, it's better to walk in on both your parents than on just one of them. Corrupti quod eligendi. Quo vitae sunt. Ut in voluptas. 2 265
1905 Carl Carlson That's it! You people have stood in my way long enough. I'm going to clown college! Quis debitis fugiat. Nulla eveniet quia. Quis distinctio recusandae. 4 265
1906 Drederick Tatum Trust me, Bart, it's better to walk in on both your parents than on just one of them. Est cupiditate odio. Laboriosam omnis voluptatem. Sunt laudantium sed. 3 265
1907 Itchy Cheating is the gift man gives himself. Fuga ipsa et. Tenetur deleniti facilis. Dolorum ducimus vel. 1 266
1908 Akira I'm not normally a praying man, but if you're up there, please save me, Superman! Voluptatibus et consequatur. Assumenda incidunt fugit. Possimus odit eum. 1 266
1909 Fat Tony Cheating is the gift man gives himself. Laudantium beatae dolor. Facilis distinctio voluptatem. Officiis aut facere. 1 266
1910 Gary You tried your best and you failed miserably. The lesson is: Never try. A qui et. Sed et ea. Dolorem ut quo. 1 267
1911 Captain Horatio McCallister D'oh! Sed dolor dolorem. Qui ea optio. Est odio deserunt. 2 267
1912 Aristotle Amadopolis Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Qui at est. Omnis aut sed. Qui asperiores vel. 1 267
1913 Mr. Costington To alcohol! The cause of, and solution to, all of life's problems. Nam eum quaerat. Aut qui aut. Distinctio voluptatibus qui. 2 267
1914 Blinky Cheating is the gift man gives himself. Molestiae velit ea. Et quasi rerum. Unde non ratione. 3 267
1915 Principal Seymour Skinner Marriage is like a coffin and each kid is another nail. Rerum et ut. Dolorem nihil architecto. Animi et et. 3 268
1916 Judge Roy Snyder Trust me, Bart, it's better to walk in on both your parents than on just one of them. Adipisci qui porro. Id totam nostrum. Eos corrupti ea. 3 268
1917 Reverend Timothy Lovejoy Cheating is the gift man gives himself. Tempora dolorum sapiente. Quasi aut magnam. Voluptatem illo qui. 3 268
1918 Old Barber Kill my boss? Do I dare live out the American dream? Vel ut quasi. Porro consequatur quia. Cumque aut aperiam. 2 268
1919 Bleeding Gums Murphy Trust me, Bart, it's better to walk in on both your parents than on just one of them. Impedit enim autem. Aut voluptas expedita. Voluptatem explicabo eligendi. 3 268
1920 Bumblebee Man D'oh! Aut ut perspiciatis. Dolorum qui magni. Cum dicta ipsam. 2 268
1921 Poor Violet If you pray to the wrong god, you might just make the right one madder and madder. Et nobis ad. Voluptatem eum placeat. Aut odit nemo. 3 268
1922 Mona Simpson Marriage is like a coffin and each kid is another nail. Tenetur quia ut. Optio ea accusamus. Rerum nesciunt quo. 2 268
1923 Cesar Marriage is like a coffin and each kid is another nail. Quod et dolores. Quo ut libero. Itaque quis et. 2 268
1924 Lou Marriage is like a coffin and each kid is another nail. Pariatur sit itaque. Qui quo qui. Quo dolor quae. 4 268
1925 Martin Prince It takes two to lie: one to lie and one to listen. Deserunt ut non. Illum consequuntur et. Vitae quo tempore. 3 269
1926 Duffman Go out on a Tuesday? Who am I, Charlie Sheen? Occaecati architecto sit. Suscipit et dolorem. Velit tenetur sint. 4 269
1927 Manjula Nahasapeemapetilon Go out on a Tuesday? Who am I, Charlie Sheen? Est nesciunt error. Molestiae consequuntur omnis. Suscipit doloribus neque. 3 269
1928 Ned Flanders Cheating is the gift man gives himself. Suscipit quia autem. Molestiae voluptatem excepturi. Iure qui repellat. 4 269
1929 Dewey Largo Trust me, Bart, it's better to walk in on both your parents than on just one of them. Sint dignissimos quis. Aut voluptatum dolores. Voluptate velit culpa. 1 269
1930 Helen Lovejoy Life is just one crushing defeat after another until you just wish Flanders was dead. Molestiae omnis eveniet. Enim sit facilis. Et in aliquam. 3 269
1931 Squeaky-Voiced Teen If you pray to the wrong god, you might just make the right one madder and madder. Natus provident nesciunt. Est facere ut. Tempora fuga esse. 2 269
1932 Waylon Smithers Cheating is the gift man gives himself. Aliquid nihil est. Dolores placeat vitae. Porro blanditiis quia. 1 269
1933 Poochie Trust me, Bart, it's better to walk in on both your parents than on just one of them. Necessitatibus autem in. Repellat voluptas qui. Qui ipsam voluptas. 4 269
1934 Mary Bailey What’s the point of going out? We’re just gonna wind up back home anyway. Quod quibusdam et. Officiis consequuntur velit. Est voluptas at. 2 269
1935 Mr. Costington It takes two to lie: one to lie and one to listen. Rerum ducimus aspernatur. Molestiae placeat assumenda. Aut rerum sit. 1 269
1936 Barney Gumble Kill my boss? Do I dare live out the American dream? Vitae dolores consequatur. Vitae vel id. In itaque delectus. 2 270
1937 Selma Bouvier When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Alias deserunt aperiam. Qui vero dolore. Reiciendis cupiditate quod. 3 270
1938 Mr. Costington Kill my boss? Do I dare live out the American dream? Cupiditate ex fuga. Tempore hic necessitatibus. Doloribus dolorum et. 4 270
1939 Martin Prince Sorry, Mom, the mob has spoken. Aut tempora aliquam. Quam aperiam vel. Vel labore eum. 2 270
1940 Gloria Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Dolor architecto rerum. In cumque molestias. Et aspernatur rerum. 2 271
1941 Old Barber If you pray to the wrong god, you might just make the right one madder and madder. Perferendis aperiam deleniti. Omnis nulla quod. Ut aspernatur est. 2 271
1942 Ling Bouvier Sorry, Mom, the mob has spoken. Nihil ipsam laudantium. Voluptate excepturi quia. Dolor in delectus. 2 271
1943 Frankie the Squealer That's it! You people have stood in my way long enough. I'm going to clown college! Non ut vero. Accusantium dignissimos perferendis. Eveniet nulla quo. 2 271
1944 Dr. Julius Hibbert Go out on a Tuesday? Who am I, Charlie Sheen? Ipsam temporibus dolor. Ab eveniet fugiat. Et consequatur distinctio. 1 271
1945 Amber Simpson It takes two to lie: one to lie and one to listen. Velit maxime unde. Cumque tenetur rerum. Iure deserunt sint. 4 271
1946 Ugolin You tried your best and you failed miserably. The lesson is: Never try. Corporis rem rerum. Laborum amet qui. Exercitationem quia sequi. 4 271
1947 Ned Flanders You tried your best and you failed miserably. The lesson is: Never try. Tenetur repellendus repudiandae. Quis adipisci quod. Fugiat sed enim. 2 271
1948 Captain Lance Murdock When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Repellat molestias non. Nam qui soluta. Incidunt iure ea. 1 271
1949 Santa''s Little Helper Trust me, Bart, it's better to walk in on both your parents than on just one of them. Quis voluptatem aut. Et ea aut. Voluptate quo aliquid. 3 271
1950 Joey It takes two to lie: one to lie and one to listen. Non animi tenetur. Pariatur sapiente quibusdam. Quod laboriosam ut. 2 272
1951 Ned Flanders Kill my boss? Do I dare live out the American dream? Maxime tempora laboriosam. Aut qui fugiat. Et quas dolorem. 4 272
1952 Reverend Timothy Lovejoy Life is just one crushing defeat after another until you just wish Flanders was dead. Perspiciatis qui corrupti. Voluptas voluptatem quam. Unde dolorem illum. 4 272
1953 Bernice Hibbert What’s the point of going out? We’re just gonna wind up back home anyway. Eaque autem perspiciatis. Quia qui libero. Et rerum reprehenderit. 4 272
1954 Üter It takes two to lie: one to lie and one to listen. Tempore minus fugiat. Quia rerum reiciendis. Distinctio quia aut. 4 272
1955 Kearney Zzyzwicz Jr. You tried your best and you failed miserably. The lesson is: Never try. Quod modi facilis. Nostrum ut sint. Aut eos dolorum. 2 272
1956 Comic Book Guy If you pray to the wrong god, you might just make the right one madder and madder. Voluptas dolorem voluptatibus. Delectus quas quia. Cum et qui. 1 273
1957 Santa''s Little Helper What’s the point of going out? We’re just gonna wind up back home anyway. Reiciendis necessitatibus inventore. Sunt quia vel. Accusamus omnis excepturi. 2 273
1958 Old Jewish Man Oh, loneliness and cheeseburgers are a dangerous mix. A qui et. Culpa laudantium et. Quia omnis id. 3 273
1959 Janey Powell When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Nam quia voluptas. Ea repellat qui. Ullam tempore sequi. 4 273
1960 Üter That's it! You people have stood in my way long enough. I'm going to clown college! Saepe amet quis. Distinctio velit rerum. Atque nam ad. 1 273
1961 Bernice Hibbert I'm not normally a praying man, but if you're up there, please save me, Superman! Enim neque quae. Et maiores est. Illo fugit est. 2 273
1962 Janey Powell D'oh! Repellendus natus debitis. Sunt accusantium sapiente. Ipsam eum doloremque. 4 273
1963 Captain Horatio McCallister D'oh! Voluptas commodi dolorem. Et sequi maxime. Non iure non. 2 273
1964 Birchibald "Birch" T. Barlow Go out on a Tuesday? Who am I, Charlie Sheen? Vitae consequatur necessitatibus. Rerum saepe nisi. Voluptatum qui voluptatibus. 1 273
1965 Mr. Costington It takes two to lie: one to lie and one to listen. Commodi voluptas nihil. Quam sit qui. Expedita et ducimus. 4 274
1966 Baby Gerald Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Qui quaerat consequatur. Necessitatibus ea ut. Et explicabo unde. 4 274
1967 Patches Violet Life is just one crushing defeat after another until you just wish Flanders was dead. Ut aut odio. Rerum dolorem adipisci. Enim officiis aut. 2 274
1968 Maude Flanders Trust me, Bart, it's better to walk in on both your parents than on just one of them. Est cupiditate nemo. Sapiente ducimus sunt. Ea quia nesciunt. 4 275
1969 Mr. Costington Kill my boss? Do I dare live out the American dream? Et vero rerum. Perferendis natus nisi. Harum autem et. 1 275
1970 Sarah Wiggum It takes two to lie: one to lie and one to listen. Doloribus dicta sit. Labore blanditiis mollitia. Dolorem ut amet. 1 275
1971 Marge Simpson That's it! You people have stood in my way long enough. I'm going to clown college! Illo est ut. Perferendis sapiente quas. Quas dicta facilis. 2 275
1972 Gloria When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Facere maiores corporis. Dolorem sit dicta. Nisi est aut. 1 275
1973 Lou Life is just one crushing defeat after another until you just wish Flanders was dead. Deleniti ducimus sapiente. Dolore qui dolorum. Impedit porro dolore. 1 275
1974 Grampa Abraham Simpson If you pray to the wrong god, you might just make the right one madder and madder. Est est nihil. Ad dignissimos ea. Aut non labore. 4 275
1975 Akira Sorry, Mom, the mob has spoken. Nihil quia ad. Repellendus cupiditate mollitia. Debitis sed eos. 2 276
1976 Chase What’s the point of going out? We’re just gonna wind up back home anyway. Qui aut eius. Non autem eveniet. Itaque ut nihil. 3 276
1977 Üter I'm not normally a praying man, but if you're up there, please save me, Superman! Aut ab quia. Voluptatem distinctio saepe. Ratione aut sit. 4 276
1978 Aristotle Amadopolis Life is just one crushing defeat after another until you just wish Flanders was dead. Non voluptas quae. Molestiae incidunt ex. Expedita qui ut. 1 276
1979 Chase It takes two to lie: one to lie and one to listen. Officiis ut atque. Doloribus excepturi sed. Consequuntur harum ea. 2 276
1980 Eddie Life is just one crushing defeat after another until you just wish Flanders was dead. Velit minus delectus. Voluptatem in ducimus. Saepe temporibus nihil. 3 276
1981 Richard D'oh! Dolore in distinctio. Voluptatem ducimus repellat. Soluta ullam accusamus. 2 276
1982 The Rich Texan Life is just one crushing defeat after another until you just wish Flanders was dead. Et sequi velit. Aut possimus eligendi. Fuga quos aliquam. 4 277
1983 Yes Guy What’s the point of going out? We’re just gonna wind up back home anyway. Quae nisi perferendis. Aut inventore vero. Dolorem ducimus optio. 2 277
1984 Nelson Muntz Cheating is the gift man gives himself. Earum reprehenderit sit. Id laboriosam ut. Sunt at perferendis. 3 277
1985 Luigi Sorry, Mom, the mob has spoken. Incidunt sequi quasi. Dolorem minima expedita. Aspernatur autem ipsum. 4 277
1986 Dr. Nick Riviera To alcohol! The cause of, and solution to, all of life's problems. Quis tenetur est. Quisquam ipsa recusandae. Culpa quod officiis. 2 277
1987 Dr. Nick Riviera Sorry, Mom, the mob has spoken. Quisquam et minus. Unde dolor esse. Dolorem id iure. 1 277
1988 Radioactive Man D'oh! Quo sequi ab. Excepturi voluptatem veniam. Et non est. 3 277
1989 Roger Meyers, Jr. What’s the point of going out? We’re just gonna wind up back home anyway. Veritatis suscipit omnis. Nihil aut nulla. Omnis architecto perspiciatis. 1 278
1990 Birchibald "Birch" T. Barlow That's it! You people have stood in my way long enough. I'm going to clown college! Possimus sunt sunt. Vero quia at. Suscipit consequatur et. 1 278
1991 Todd Flanders Marriage is like a coffin and each kid is another nail. Id et exercitationem. Ratione labore magni. Eaque minima quod. 4 278
1992 Blinky Cheating is the gift man gives himself. Quia sed suscipit. Consectetur optio et. Atque repellat quod. 1 278
1993 Jacques Go out on a Tuesday? Who am I, Charlie Sheen? Sapiente alias hic. Sunt architecto voluptate. Voluptates saepe quae. 1 278
1994 Cookie Kwan What’s the point of going out? We’re just gonna wind up back home anyway. Aspernatur repellat magnam. Enim id deleniti. Voluptatibus et ab. 2 278
1995 Cesar It takes two to lie: one to lie and one to listen. Earum enim eligendi. Quo doloribus aliquid. Porro omnis quia. 4 278
1996 Cletus Spuckler Cheating is the gift man gives himself. Mollitia facilis asperiores. Eveniet aut qui. Optio voluptatem aut. 4 279
1997 Squeaky-Voiced Teen Trust me, Bart, it's better to walk in on both your parents than on just one of them. Tempore libero omnis. Distinctio exercitationem at. Provident ex officiis. 3 279
1998 Kent Brockman Life is just one crushing defeat after another until you just wish Flanders was dead. Et suscipit itaque. Consequatur hic ut. Ab facilis tempore. 1 279
1999 Benjamin Sorry, Mom, the mob has spoken. Porro qui aut. Perspiciatis error et. Repudiandae labore est. 1 279
2000 Rabbi Hyman Krustofski D'oh! Modi aut voluptatem. Rerum soluta aspernatur. Vitae doloremque vel. 3 279
2001 Atkins, State Comptroller To alcohol! The cause of, and solution to, all of life's problems. Et ut animi. Odit beatae facere. Quaerat recusandae illum. 1 279
2002 Comic Book Guy When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Perspiciatis consequuntur voluptatum. Blanditiis voluptate accusantium. Iusto suscipit sequi. 3 279
2003 Sideshow Mel It takes two to lie: one to lie and one to listen. Et id atque. Consequatur rerum mollitia. Assumenda asperiores delectus. 2 279
2004 Old Barber Cheating is the gift man gives himself. Libero doloribus facilis. Est magni laudantium. Vel debitis quia. 1 279
2005 Rabbi Hyman Krustofski D'oh! Et animi eaque. Enim pariatur dolor. Fugiat inventore vitae. 2 279
2006 Rainier Wolfcastle That's it! You people have stood in my way long enough. I'm going to clown college! Esse aliquam sed. Sed voluptas quia. Illum cumque dicta. 2 279
2007 Judge Roy Snyder Sorry, Mom, the mob has spoken. Repellendus quia pariatur. Iusto aliquid aut. Omnis aperiam laborum. 4 279
2008 Patches Violet What’s the point of going out? We’re just gonna wind up back home anyway. Nobis totam dolor. Voluptate amet nemo. Adipisci quas rerum. 1 280
2009 Milhouse Van Houten If you pray to the wrong god, you might just make the right one madder and madder. Fuga ea veniam. Aut eligendi non. Velit totam asperiores. 4 280
2010 Gunter It takes two to lie: one to lie and one to listen. Et porro qui. Harum ducimus fugiat. In quod placeat. 2 280
2011 Duffman Marriage is like a coffin and each kid is another nail. Aliquid sed iure. Enim dolor et. Est illum ut. 2 280
2012 Patty Bouvier Kill my boss? Do I dare live out the American dream? Exercitationem maxime quaerat. Ipsa reiciendis voluptas. Voluptas atque ab. 3 280
2013 Dr. Nick Riviera That's it! You people have stood in my way long enough. I'm going to clown college! Quaerat iste expedita. Sapiente ad explicabo. Distinctio et possimus. 2 281
2014 Wiseguy I'm not normally a praying man, but if you're up there, please save me, Superman! Vel veritatis numquam. Nostrum quia tempore. Dolor id quo. 1 281
2015 Ms. Albright You tried your best and you failed miserably. The lesson is: Never try. Maiores eum ut. Velit eum consequatur. Dolorem voluptatibus explicabo. 3 281
2016 Maude Flanders To alcohol! The cause of, and solution to, all of life's problems. Exercitationem maxime tempora. Quas impedit ut. Amet temporibus quia. 2 281
2017 Snowball Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Quo et veniam. Recusandae nihil velit. Autem dignissimos ab. 2 281
2018 Brandine Spuckler When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Quia in atque. Et iusto iure. Nam culpa nobis. 1 281
2019 Jacqueline Bouvier I'm not normally a praying man, but if you're up there, please save me, Superman! Mollitia esse sed. Omnis excepturi officia. Tenetur et illo. 2 281
2020 Charlie It takes two to lie: one to lie and one to listen. Dolores deleniti voluptas. Itaque sapiente nam. Inventore voluptatem ad. 2 281
2021 Gary When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Eius occaecati inventore. Dolor occaecati aliquid. Nesciunt quia doloremque. 3 281
2022 Jacqueline Bouvier If you pray to the wrong god, you might just make the right one madder and madder. Velit et aut. Recusandae fugit ratione. Dolorum quos perspiciatis. 1 281
2023 Maggie Simpson Sorry, Mom, the mob has spoken. Suscipit voluptas ut. Quam facere similique. Ullam fugit in. 4 281
2024 The Rich Texan What’s the point of going out? We’re just gonna wind up back home anyway. Voluptatem quae necessitatibus. Possimus non dolor. Tempore tenetur magni. 3 282
2025 Agnes Skinner I'm not normally a praying man, but if you're up there, please save me, Superman! Voluptas dicta eveniet. Ab aut placeat. Omnis saepe suscipit. 4 282
2026 Maude Flanders Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Consequatur occaecati quidem. Cupiditate dolores fuga. Et assumenda soluta. 3 282
2027 Database It takes two to lie: one to lie and one to listen. Libero laboriosam quisquam. Minima est quia. Omnis temporibus molestiae. 3 282
2028 Mr. Teeny Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Velit consectetur culpa. Explicabo deleniti quis. Quos tenetur voluptatibus. 4 282
2029 Arnie Pye It takes two to lie: one to lie and one to listen. Perspiciatis accusamus dolores. Et alias non. Voluptatem veniam in. 3 282
2030 Ralph Wiggum Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Expedita aut deserunt. Dolor tempore nobis. Odio eos voluptatem. 3 282
2031 Lindsey Naegle It takes two to lie: one to lie and one to listen. Sit natus alias. Cumque eos dolores. Esse blanditiis fugiat. 3 282
2032 Kearney Zzyzwicz Jr. Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Quaerat quos ea. Dignissimos quas eius. Et ad consequuntur. 3 282
2033 Drederick Tatum Life is just one crushing defeat after another until you just wish Flanders was dead. Vel et sed. Quibusdam laboriosam necessitatibus. Fuga maiores et. 3 282
2034 Lenny Leonard It takes two to lie: one to lie and one to listen. Iure labore qui. A voluptatibus assumenda. Omnis adipisci suscipit. 3 282
2035 Boobarella Oh, loneliness and cheeseburgers are a dangerous mix. Cumque temporibus et. Tempore expedita qui. Officia voluptatem porro. 4 282
2036 Bumblebee Man Oh, loneliness and cheeseburgers are a dangerous mix. Officiis beatae illum. Iusto quasi aperiam. Dignissimos esse ea. 4 283
2037 Gino Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Ad ex saepe. Voluptate unde facere. Ea sit consequatur. 4 283
2038 Dr. Marvin Monroe To alcohol! The cause of, and solution to, all of life's problems. Quasi dolorem ut. Ea rem molestiae. Reiciendis quam sint. 3 283
2039 Judge Roy Snyder Oh, loneliness and cheeseburgers are a dangerous mix. Porro nesciunt sed. Impedit quisquam recusandae. Blanditiis omnis culpa. 4 283
2040 Krusty the Clown Sorry, Mom, the mob has spoken. Accusantium laudantium non. Sint error provident. Sint soluta ut. 1 283
2041 Gino I'm not normally a praying man, but if you're up there, please save me, Superman! Repellat magni nihil. Natus aspernatur neque. Et eaque voluptas. 3 283
2042 Terri If you pray to the wrong god, you might just make the right one madder and madder. Molestiae ab alias. Saepe quibusdam quis. Accusamus officia voluptatem. 1 284
2043 Martin Prince What’s the point of going out? We’re just gonna wind up back home anyway. Et voluptatum illo. Quisquam rerum et. Perspiciatis consequatur ut. 4 284
2044 Ned Flanders Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Recusandae placeat sunt. Ipsa doloribus ea. Nemo sint voluptas. 2 284
2045 Rabbi Hyman Krustofski Sorry, Mom, the mob has spoken. Pariatur deleniti ut. Cum illo aspernatur. Ducimus et amet. 2 284
2046 Lionel Hutz To alcohol! The cause of, and solution to, all of life's problems. Quas veniam dolorem. Fugiat optio tempora. Earum molestiae est. 3 284
2047 Poor Violet If you pray to the wrong god, you might just make the right one madder and madder. Ut consectetur ad. Officia voluptatem nisi. Itaque debitis et. 2 284
2048 Birchibald "Birch" T. Barlow When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Nostrum consectetur blanditiis. Quas cum recusandae. Earum quia architecto. 1 284
2049 Dr. Velimirovic Sorry, Mom, the mob has spoken. Inventore iure molestiae. Consequatur alias asperiores. Natus et id. 2 284
2050 Lindsey Naegle Marriage is like a coffin and each kid is another nail. Ullam dolorum ad. Odio eveniet possimus. Eos ipsa harum. 1 284
2051 Snowball If you pray to the wrong god, you might just make the right one madder and madder. Odio cum dolores. Eum occaecati et. Pariatur dolorem ipsum. 1 284
2052 Akira Cheating is the gift man gives himself. Deleniti quas ratione. Porro ab numquam. Voluptate quia eos. 1 285
2053 Maude Flanders To alcohol! The cause of, and solution to, all of life's problems. Velit sed id. Repudiandae error nam. Natus ducimus sint. 2 285
2054 Rabbi Hyman Krustofski Trust me, Bart, it's better to walk in on both your parents than on just one of them. Natus enim exercitationem. Accusamus sint nisi. Praesentium et odio. 4 285
2055 Mrs. Glick Marriage is like a coffin and each kid is another nail. Et dolores omnis. Qui dolorem eum. Fugit aut dolore. 2 285
2056 Jacqueline Bouvier You tried your best and you failed miserably. The lesson is: Never try. Enim hic consequatur. Distinctio dolorum quam. Eum cumque in. 1 285
2057 Coach Lugash When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Odio illo adipisci. Minus sint perferendis. Repellendus eos omnis. 2 285
2058 Benjamin To alcohol! The cause of, and solution to, all of life's problems. Atque minima iure. Magni vel soluta. Quasi laborum est. 2 285
2059 Elizabeth Hoover I'm not normally a praying man, but if you're up there, please save me, Superman! Voluptatem velit perspiciatis. Corrupti eos quia. Voluptas est iusto. 2 285
2060 Judge Constance Harm Marriage is like a coffin and each kid is another nail. Beatae velit sint. Maiores eos vel. Temporibus consequatur qui. 4 285
2061 Amber Simpson Cheating is the gift man gives himself. Vel et beatae. Magni voluptatibus quod. Totam esse nemo. 3 285
2062 Charlie That's it! You people have stood in my way long enough. I'm going to clown college! Vel exercitationem illum. Quibusdam est vel. Voluptate qui sint. 2 285
2063 Cletus Spuckler Oh, loneliness and cheeseburgers are a dangerous mix. Voluptas adipisci quos. Qui non a. Eos quam ipsa. 3 285
2064 Judge Constance Harm That's it! You people have stood in my way long enough. I'm going to clown college! Magni et rerum. Laborum autem qui. Aut ullam possimus. 2 286
2065 Gil Gunderson That's it! You people have stood in my way long enough. I'm going to clown college! Unde blanditiis fugit. Et et culpa. Est aut hic. 4 286
2066 Hans Moleman Sorry, Mom, the mob has spoken. Amet omnis ut. Libero fugiat voluptate. Laboriosam nemo est. 3 286
2067 Captain Lance Murdock Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Voluptas deserunt dolores. Expedita tempore voluptas. Minima qui autem. 4 286
2068 Atkins, State Comptroller Sorry, Mom, the mob has spoken. Consequatur perspiciatis non. Beatae alias ut. Qui quasi fuga. 1 286
2069 Rod Flanders D'oh! Numquam libero minus. Dicta illum nisi. Vel tenetur iste. 2 286
2070 Cookie Kwan To alcohol! The cause of, and solution to, all of life's problems. Iusto debitis et. Iure atque sit. Eius et dignissimos. 3 286
2071 Patty Bouvier Trust me, Bart, it's better to walk in on both your parents than on just one of them. Ut id consequuntur. Veritatis quidem architecto. Qui fuga sed. 4 286
2072 Ruth Powers To alcohol! The cause of, and solution to, all of life's problems. Distinctio iste voluptatum. Vel eos eum. Cumque quae dignissimos. 4 286
2073 Brandine Spuckler To alcohol! The cause of, and solution to, all of life's problems. Eveniet aut molestiae. Ea facere animi. Ad at labore. 1 286
2074 Sherri It takes two to lie: one to lie and one to listen. Officiis consequuntur sit. Id ratione corporis. Maiores quia magni. 3 286
2075 Captain Horatio McCallister You tried your best and you failed miserably. The lesson is: Never try. Rerum aliquam odit. Animi officiis velit. Consequatur quia est. 2 287
2076 Manjula Nahasapeemapetilon Marriage is like a coffin and each kid is another nail. Numquam veniam provident. Porro at eaque. Tempore facilis voluptatem. 1 287
2077 Scott Christian D'oh! Unde dolore vel. Accusamus maxime reprehenderit. Quia at repellendus. 2 287
2078 Leopold I'm not normally a praying man, but if you're up there, please save me, Superman! Qui iure praesentium. Expedita porro omnis. Quisquam earum omnis. 1 287
2079 Lurleen Lumpkin Cheating is the gift man gives himself. Neque at reprehenderit. Perferendis sint vel. Deserunt ipsa exercitationem. 1 288
2080 Chase If you pray to the wrong god, you might just make the right one madder and madder. Temporibus quo aut. Accusantium dolorum beatae. Nihil commodi ab. 2 288
2081 Gil Gunderson What’s the point of going out? We’re just gonna wind up back home anyway. Qui rerum ipsum. Ex in quia. Facilis rerum nulla. 2 288
2082 Gary Life is just one crushing defeat after another until you just wish Flanders was dead. Omnis rerum corrupti. Molestiae hic iure. Sunt rem numquam. 3 288
2083 Atkins, State Comptroller Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Rerum sed totam. Voluptas officiis omnis. Et porro perspiciatis. 2 288
2084 Ned Flanders I'm not normally a praying man, but if you're up there, please save me, Superman! Ad quia tempore. Sit laborum sint. Officia enim laboriosam. 4 288
2085 Troy McClure If you pray to the wrong god, you might just make the right one madder and madder. Doloremque eum recusandae. Molestiae corporis ipsam. Ipsum doloremque quia. 3 288
2086 Rabbi Hyman Krustofski That's it! You people have stood in my way long enough. I'm going to clown college! Quidem asperiores quas. Aut cupiditate ullam. Neque quod perferendis. 3 288
2087 Charles Montgomery Burns That's it! You people have stood in my way long enough. I'm going to clown college! Enim voluptatem qui. Corrupti esse possimus. Velit labore voluptas. 2 288
2088 Bleeding Gums Murphy You tried your best and you failed miserably. The lesson is: Never try. Et aut ut. Aliquam deleniti dicta. Culpa fugit voluptatem. 4 288
2089 Captain Lance Murdock Trust me, Bart, it's better to walk in on both your parents than on just one of them. Sapiente quibusdam odit. Voluptatum officia reprehenderit. Doloribus expedita non. 1 288
2090 Scott Christian Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Est et nostrum. In expedita molestiae. Minima et et. 1 289
2091 Chief Clancy Wiggum It takes two to lie: one to lie and one to listen. Dolore ipsum molestiae. Dolorum ipsam tenetur. Corrupti fugiat beatae. 2 289
2092 The Rich Texan Oh, loneliness and cheeseburgers are a dangerous mix. Velit est quo. Qui eum sint. Itaque consequatur provident. 3 289
2093 Bart Simpson If you pray to the wrong god, you might just make the right one madder and madder. A amet sed. Assumenda sint facere. Dolorem beatae culpa. 3 289
2094 Atkins, State Comptroller Cheating is the gift man gives himself. Eum ratione architecto. Quis rem molestiae. Ut maiores sit. 3 289
2095 Rabbi Hyman Krustofski Marriage is like a coffin and each kid is another nail. Quod molestiae fugit. Necessitatibus in ut. Voluptatibus cupiditate quisquam. 3 289
2096 Charlie Kill my boss? Do I dare live out the American dream? Quasi enim repellat. Accusamus placeat veritatis. Nulla est corrupti. 3 289
2097 Lionel Hutz Trust me, Bart, it's better to walk in on both your parents than on just one of them. Veritatis ipsa soluta. Est cumque voluptatem. Occaecati voluptates id. 3 289
2098 Boobarella Books are useless! I only ever read one book, To Kill A Mockingbird, and it gave me absolutely no insight on how to kill mockingbirds! Odio omnis exercitationem. Est vero fuga. Voluptatem sit dicta. 2 289
2099 Bart Simpson It takes two to lie: one to lie and one to listen. Ea rerum quia. Animi laborum dolorum. Blanditiis iure et. 4 289
2100 Moe Szyslak Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers. Magni recusandae qui. Ipsa pariatur voluptate. Voluptas dolor sunt. 3 289
2101 Troy McClure I'm not normally a praying man, but if you're up there, please save me, Superman! Amet provident ut. Id dolores esse. Consequatur maxime eaque. 4 290
2102 Todd Flanders Trust me, Bart, it's better to walk in on both your parents than on just one of them. Assumenda enim qui. Veniam necessitatibus ipsum. Voluptatem rerum harum. 4 290
2103 Helen Lovejoy Sorry, Mom, the mob has spoken. Iure alias magni. Magnam aut et. Ut quos rerum. 4 290
2104 Üter You tried your best and you failed miserably. The lesson is: Never try. Vel eaque aliquam. Quia occaecati nihil. Nisi repellendus commodi. 3 291
2105 Dolph Sorry, Mom, the mob has spoken. Assumenda repellendus expedita. Et pariatur labore. Nobis fugit dicta. 2 291
2106 Ned Flanders Kill my boss? Do I dare live out the American dream? Quia consectetur incidunt. Est beatae quia. Voluptas odit est. 1 291
2107 Dave Shutton Kill my boss? Do I dare live out the American dream? Ex similique voluptatem. Temporibus nihil debitis. Reiciendis ipsa excepturi. 4 291
2108 Charles Montgomery Burns Kill my boss? Do I dare live out the American dream? Aut sed ut. Impedit consectetur et. Maiores ut sunt. 4 291
2109 Dewey Largo When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Architecto harum odio. Aperiam ab provident. Et laborum nostrum. 3 291
2110 Wendell Borton Oh, loneliness and cheeseburgers are a dangerous mix. Itaque est quia. Esse id laboriosam. Voluptatem facilis optio. 2 292
2111 Capital City Goofball It takes two to lie: one to lie and one to listen. Incidunt dolores vel. Aliquid et aut. Non qui totam. 3 292
2112 Duffman D'oh! Beatae sapiente est. Voluptatem repellat nesciunt. Id cupiditate deserunt. 1 292
2113 Squeaky-Voiced Teen Cheating is the gift man gives himself. Et dolor rerum. Debitis fugiat consequatur. Soluta beatae illum. 3 292
2114 Francesca It takes two to lie: one to lie and one to listen. Aut ad dicta. Aliquam voluptates sed. Unde aut et. 4 292
2115 Jasper Beardly Kill my boss? Do I dare live out the American dream? Debitis alias saepe. Alias eius officiis. Aut rerum eaque. 2 292
2116 Itchy Life is just one crushing defeat after another until you just wish Flanders was dead. Nam aspernatur veritatis. Quaerat enim est. Quasi aliquam incidunt. 3 292
2117 Radioactive Man You tried your best and you failed miserably. The lesson is: Never try. Aliquid rerum sed. Error repellendus tempora. Sint commodi eligendi. 3 292
2118 Duffman Trust me, Bart, it's better to walk in on both your parents than on just one of them. At mollitia aliquam. Velit fugit ducimus. Dolorem et et. 2 292
2119 Cookie Kwan That's it! You people have stood in my way long enough. I'm going to clown college! Consequatur vel delectus. Atque necessitatibus ipsam. Assumenda iste qui. 3 292
2120 Blinky Go out on a Tuesday? Who am I, Charlie Sheen? Ducimus ex aliquid. Officia eveniet totam. Necessitatibus sapiente consequuntur. 2 293
2121 Dewey Largo Oh, loneliness and cheeseburgers are a dangerous mix. Voluptas quo odio. Voluptatem id dicta. Dolores pariatur animi. 4 293
2122 Krusty the Clown That's it! You people have stood in my way long enough. I'm going to clown college! Qui id molestiae. Cupiditate aut sint. Officia rem quis. 4 293
2123 Lewis Oh, loneliness and cheeseburgers are a dangerous mix. Maxime aut sit. Ea consequatur ratione. Ad sit et. 2 293
2124 Selma Bouvier Oh, loneliness and cheeseburgers are a dangerous mix. Et similique qui. Suscipit aut perspiciatis. Neque asperiores et. 2 293
2125 Ginger Flanders What’s the point of going out? We’re just gonna wind up back home anyway. Nisi officiis ut. Odit numquam ea. Labore laborum quibusdam. 4 293
2126 Sideshow Bob D'oh! Veniam qui ducimus. Nihil nobis odio. Tenetur autem et. 2 293
2127 Dolph Kill my boss? Do I dare live out the American dream? Ducimus deleniti natus. Aut soluta rem. Repellat qui animi. 1 293
2128 Ruth Powers When will I learn? The answers to life’s problems aren’t at the bottom of a bottle, they’re on TV! Veritatis id cupiditate. Facilis voluptatem mollitia. Officia ipsa omnis. 3 293
\.
--
-- Data for Name: schema_migrations; Type: TABLE DATA; Schema: public; Owner: Sam
--
COPY public.schema_migrations (version) FROM stdin;
20190809155458
20190809155544
20190809160656
\.
--
-- Name: products_id_seq; Type: SEQUENCE SET; Schema: public; Owner: Sam
--
SELECT pg_catalog.setval('public.products_id_seq', 293, true);
--
-- Name: reviews_id_seq; Type: SEQUENCE SET; Schema: public; Owner: Sam
--
SELECT pg_catalog.setval('public.reviews_id_seq', 2128, true);
--
-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: Sam
--
ALTER TABLE ONLY public.ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
--
-- Name: products products_pkey; Type: CONSTRAINT; Schema: public; Owner: Sam
--
ALTER TABLE ONLY public.products
ADD CONSTRAINT products_pkey PRIMARY KEY (id);
--
-- Name: reviews reviews_pkey; Type: CONSTRAINT; Schema: public; Owner: Sam
--
ALTER TABLE ONLY public.reviews
ADD CONSTRAINT reviews_pkey PRIMARY KEY (id);
--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: Sam
--
ALTER TABLE ONLY public.schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
--
-- Name: reviews fk_rails_bedd9094d4; Type: FK CONSTRAINT; Schema: public; Owner: Sam
--
ALTER TABLE ONLY public.reviews
ADD CONSTRAINT fk_rails_bedd9094d4 FOREIGN KEY (product_id) REFERENCES public.products(id);
--
-- PostgreSQL database dump complete
--
| 105.233918 | 241 | 0.786413 |
c60f5f913ee4f1f60f1c73a9dc69635273db9b5a | 1,193 | rb | Ruby | app/controllers/strongbolt/user_groups_users_controller.rb | hiteshpatwari/strongbolt | dfa98882b838aa34707ed15e9800aab4ad77daf3 | [
"MIT"
] | null | null | null | app/controllers/strongbolt/user_groups_users_controller.rb | hiteshpatwari/strongbolt | dfa98882b838aa34707ed15e9800aab4ad77daf3 | [
"MIT"
] | null | null | null | app/controllers/strongbolt/user_groups_users_controller.rb | hiteshpatwari/strongbolt | dfa98882b838aa34707ed15e9800aab4ad77daf3 | [
"MIT"
] | 1 | 2020-02-07T06:00:38.000Z | 2020-02-07T06:00:38.000Z | module Strongbolt
class UserGroupsUsersController < ::StrongboltController
self.model_for_authorization = "Strongbolt::UserGroup"
def create
@user_group = UserGroup.find(params[:user_group_id])
@user = Strongbolt.user_class_constant.find(params[:id])
@user_group.users << @user unless @user_group.users.include?(@user)
redirect_to request.referrer || user_group_path(@user_group)
rescue ActiveRecord::RecordNotUnique
# user was already in the group, just ignoring this
redirect_to request.referrer || user_group_path(@user_group)
end
def destroy
@user_group = UserGroup.find(params[:user_group_id])
@user = Strongbolt.user_class_constant.find(params[:id])
@user_group.users.delete @user
redirect_to request.referrer || user_group_path(@user_group)
end
rescue_from ActiveRecord::RecordNotFound do |e|
if @user_group.nil?
flash[:danger] = "User Group ##{params[:user_group_id]} does not exist"
redirect_to user_groups_path
else
flash[:danger] = "User ##{params[:id]} does not exist"
redirect_to user_group_path(@user_group)
end
end
end
end
| 30.589744 | 79 | 0.69824 |
e9eb5b833f3c19cc673059dc645d337c440b12d7 | 6,358 | rs | Rust | src/core/util.rs | AliDeym/RustCraftClassic | 0c4067411a28d890d29926864710b900bcd83b8a | [
"MIT"
] | 5 | 2020-07-18T06:27:21.000Z | 2021-08-31T07:00:57.000Z | src/core/util.rs | AliDeym/RustCraftClassic | 0c4067411a28d890d29926864710b900bcd83b8a | [
"MIT"
] | 2 | 2020-07-22T07:04:27.000Z | 2020-08-03T04:52:49.000Z | src/core/util.rs | AliDeym/RustCraftClassic | 0c4067411a28d890d29926864710b900bcd83b8a | [
"MIT"
] | null | null | null | /*
Copyright (c) 2020 Ali Deym
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
pub fn math_min(num1: u8, num2: u8) -> u8 {
if num1 < num2 {
num1
} else {
num2
}
}
pub struct Vec3D<T = u16>(pub T, pub T, pub T)
where
T: Copy,
T: Sized,
T: Clone;
impl Clone for Vec3D {
fn clone(&self) -> Self {
Self(self.0, self.1, self.2)
}
}
impl Copy for Vec3D {}
impl<T> Vec3D<T>
where
T: Copy,
T: Sized,
T: Clone,
{
pub fn new(x: T, y: T, z: T) -> Vec3D<T> {
Vec3D { 0: x, 1: y, 2: z }
}
pub fn get_x(&self) -> T {
self.0
}
pub fn get_y(&self) -> T {
self.1
}
pub fn get_z(&self) -> T {
self.2
}
pub fn set_x(&mut self, x: T) {
self.0 = x;
}
pub fn set_y(&mut self, y: T) {
self.1 = y;
}
pub fn set_z(&mut self, z: T) {
self.2 = z;
}
}
pub struct Transform {
position: Vec3D,
yaw: u8,
pitch: u8,
}
impl Clone for Transform {
fn clone(&self) -> Self {
Self::new(self.position, self.yaw, self.pitch)
}
}
impl Transform {
pub fn new(position: Vec3D, yaw: u8, pitch: u8) -> Transform {
Transform {
position,
yaw,
pitch,
}
}
pub fn default() -> Transform {
Self::new(Vec3D::new(0, 0, 0), 0, 0)
}
pub fn get_pos(&self) -> &Vec3D {
&self.position
}
pub fn get_yaw(&self) -> u8 {
self.yaw
}
pub fn get_pitch(&self) -> u8 {
self.pitch
}
pub fn set_pos(&mut self, x: u16, y: u16, z: u16) {
self.position.0 = x;
self.position.1 = y;
self.position.2 = z;
}
pub fn set_yaw(&mut self, yaw: u8) {
self.yaw = yaw;
}
pub fn set_pitch(&mut self, pitch: u8) {
self.pitch = pitch;
}
}
pub struct BufferWriter {
buffer: Vec<u8>,
}
impl BufferWriter {
pub fn new(size: usize) -> BufferWriter {
BufferWriter {
buffer: Vec::<u8>::with_capacity(size),
}
}
pub fn get_data(&self) -> &Vec<u8> {
&self.buffer
}
pub fn write_byte(&mut self, data: u8) {
self.buffer.push(data);
}
pub fn write_sbyte(&mut self, data: i8) {
self.buffer.push(data as u8);
}
pub fn write_short(&mut self, data: u16) {
let bytes = data.to_be_bytes();
self.buffer.extend(&bytes[..]);
}
pub fn write_uint(&mut self, data: u32) {
let bytes = data.to_be_bytes();
self.buffer.extend(&bytes[..]);
}
pub fn write_int(&mut self, data: i32) {
let bytes = data.to_be_bytes();
self.buffer.extend(&bytes[..]);
}
pub fn write_string(&mut self, data: &str) {
let mut char_iter = data.as_bytes().iter();
for _ in 0..64 {
self.buffer.push(*char_iter.next().unwrap_or(&b' ') as u8);
}
}
pub fn write_vec3d(&mut self, data: &Vec3D) {
self.write_short(data.0);
self.write_short(data.1);
self.write_short(data.2);
}
pub fn write_transform(&mut self, data: &Transform) {
self.write_vec3d(data.get_pos());
self.write_byte(data.yaw);
self.write_byte(data.pitch);
}
pub fn write_array(&mut self, data: &[u8]) {
if data.len() > 1024 {
self.buffer.extend(data.split_at(1024).0);
return;
}
self.buffer.extend(data);
}
}
pub struct BufferReader<'a> {
index: usize,
buffer: &'a Vec<u8>,
}
impl<'a> BufferReader<'a> {
pub fn new(buffer: &'a Vec<u8>) -> BufferReader {
BufferReader { index: 0, buffer }
}
pub fn get_index(&self) -> usize {
self.index
}
pub fn read_byte(&mut self) -> u8 {
self.index += 1;
// In case we receive a timeout/packetloss, 0xff (255) will be returned.
*self.buffer.get(self.index - 1).unwrap_or(&0xff)
}
pub fn read_sbyte(&mut self) -> i8 {
self.index += 1;
// In case we receive a timeout/packetloss, 0xff (255) will be returned.
*self.buffer.get(self.index - 1).unwrap_or(&0xff) as i8
}
pub fn read_ushort(&mut self) -> u16 {
let b1 = self.read_byte();
let b2 = self.read_byte();
(b1 as u16) << 8 | b2 as u16
}
pub fn read_ushort_le(&mut self) -> u16 {
let b1 = self.read_byte();
let b2 = self.read_byte();
(b2 as u16) << 8 | b1 as u16
}
pub fn read_short(&mut self) -> i16 {
let b1 = self.read_byte();
let b2 = self.read_byte();
(b1 as i16) << 8 | b2 as i16
}
pub fn read_short_le(&mut self) -> i16 {
let b1 = self.read_byte();
let b2 = self.read_byte();
(b2 as i16) << 8 | b1 as i16
}
pub fn read_string(&mut self) -> String {
let grabbed = String::from_utf8(self.buffer[self.index..self.index + 64].to_vec())
.unwrap_or(String::from(""));
self.index += 64;
String::from(grabbed.trim())
}
/// Reads to the end of the stream.
/// NOTE that this method will not change the buffer index.
pub fn read_to_end(&mut self) -> Vec<u8> {
self.buffer[self.index..self.buffer.len() - self.index + 1].to_vec()
}
}
| 23.12 | 90 | 0.560554 |
40c189cec92b243e051eb8fb63ff917f960d1c8f | 3,588 | py | Python | heronpy/streamlet/impl/transformbolt.py | pjfanning/incubator-heron | 7db7c24733bd7e66ecfe704ea65f864d1fff4adc | [
"Apache-2.0"
] | 3,348 | 2016-05-25T16:04:31.000Z | 2018-03-28T17:46:14.000Z | heronpy/streamlet/impl/transformbolt.py | pjfanning/incubator-heron | 7db7c24733bd7e66ecfe704ea65f864d1fff4adc | [
"Apache-2.0"
] | 1,542 | 2016-05-25T16:46:44.000Z | 2018-03-29T17:30:23.000Z | heronpy/streamlet/impl/transformbolt.py | pjfanning/incubator-heron | 7db7c24733bd7e66ecfe704ea65f864d1fff4adc | [
"Apache-2.0"
] | 702 | 2016-05-25T16:07:43.000Z | 2018-03-27T06:31:07.000Z | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""module for map bolt: TransformBolt"""
from heronpy.api.bolt.bolt import Bolt
from heronpy.api.state.stateful_component import StatefulComponent
from heronpy.api.component.component_spec import GlobalStreamId
from heronpy.api.stream import Grouping
from heronpy.streamlet.streamlet import Streamlet
from heronpy.streamlet.transformoperator import TransformOperator
from heronpy.streamlet.impl.contextimpl import ContextImpl
from heronpy.streamlet.impl.streamletboltbase import StreamletBoltBase
# pylint: disable=unused-argument
class TransformBolt(Bolt, StatefulComponent, StreamletBoltBase):
"""TransformBolt"""
OPERATOR = 'operator'
# pylint: disable=attribute-defined-outside-init
def init_state(self, stateful_state):
self._state = stateful_state
def pre_save(self, checkpoint_id):
# Nothing really
pass
def initialize(self, config, context):
self.logger.debug("TransformBolt's Component-specific config: \n%s", str(config))
self.processed = 0
self.emitted = 0
if TransformBolt.OPERATOR in config:
self._transform_operator = config[TransformBolt.OPERATOR]
else:
raise RuntimeError("TransformBolt needs to be passed transform_operator")
if hasattr(self, '_state'):
contextimpl = ContextImpl(context, self._state, self)
else:
contextimpl = ContextImpl(context, None, self)
self._transform_operator.setup(contextimpl)
def process(self, tup):
self.transform_operator.transform(tup)
self.processed += 1
self.ack(tup)
# pylint: disable=protected-access
class TransformStreamlet(Streamlet):
"""TransformStreamlet"""
def __init__(self, transform_operator, parent):
super().__init__()
if not isinstance(transform_operator, TransformOperator):
raise RuntimeError("Transform Operator has to be a TransformOperator")
if not isinstance(parent, Streamlet):
raise RuntimeError("parent of Transform Streamlet has to be a Streamlet")
self._transform_operator = transform_operator
self._parent = parent
self.set_num_partitions(parent.get_num_partitions())
def _calculate_inputs(self):
return {GlobalStreamId(self._parent.get_name(), self._parent._output) :
Grouping.SHUFFLE}
def _build_this(self, builder, stage_names):
if not self.get_name():
self.set_name(self._default_stage_name_calculator("transform", stage_names))
if self.get_name() in stage_names:
raise RuntimeError("Duplicate Names")
stage_names.add(self.get_name())
builder.add_bolt(self.get_name(), TransformBolt, par=self.get_num_partitions(),
inputs=self._calculate_inputs(),
config={TransformBolt.OPERATOR : self._transform_operator})
return True
| 39.428571 | 85 | 0.748885 |
bc789c3777eac22c4e2eeac2ed8cf07541225c7a | 13,560 | pkb | SQL | test/ut3_tester/core/annotations/test_annotation_parser.pkb | felipebz/utPLSQL | b4d72e391f2e7f5d920ec08744a30431ef201027 | [
"Apache-2.0"
] | 471 | 2016-02-16T12:41:57.000Z | 2022-03-20T15:31:36.000Z | test/ut3_tester/core/annotations/test_annotation_parser.pkb | felipebz/utPLSQL | b4d72e391f2e7f5d920ec08744a30431ef201027 | [
"Apache-2.0"
] | 904 | 2016-01-31T00:48:53.000Z | 2022-03-31T23:41:46.000Z | test/ut3_tester/core/annotations/test_annotation_parser.pkb | felipebz/utPLSQL | b4d72e391f2e7f5d920ec08744a30431ef201027 | [
"Apache-2.0"
] | 210 | 2016-01-31T00:23:09.000Z | 2022-03-28T09:13:50.000Z | create or replace package body test_annotation_parser is
procedure test_proc_comments is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
-- %suite
-- %displayname(Name of suite)
-- %suitepath(all.globaltests)
-- %ann1(Name of suite)
-- wrong line
-- %ann2(some_value)
procedure foo;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation(2,'suite',null, null),
ut3_develop.ut_annotation(3,'displayname','Name of suite',null),
ut3_develop.ut_annotation(4,'suitepath','all.globaltests',null),
ut3_develop.ut_annotation(6,'ann1','Name of suite',null),
ut3_develop.ut_annotation(8,'ann2','some_value','foo')
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure include_floating_annotations is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
-- %suite
-- %displayname(Name of suite)
-- %suitepath(all.globaltests)
-- %ann1(Name of suite)
-- %ann2(all.globaltests)
--%test
procedure foo;
-- %ann3(Name of suite)
-- %ann4(all.globaltests)
--%test
procedure bar;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', null, null ),
ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null ),
ut3_develop.ut_annotation( 6, 'ann1', 'Name of suite', null ),
ut3_develop.ut_annotation( 7, 'ann2', 'all.globaltests', null ),
ut3_develop.ut_annotation( 9, 'test', null, 'foo'),
ut3_develop.ut_annotation( 12, 'ann3', 'Name of suite', null ),
ut3_develop.ut_annotation( 13, 'ann4', 'all.globaltests', null ),
ut3_develop.ut_annotation( 15, 'test', null, 'bar')
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure parse_complex_with_functions is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
-- %suite
-- %displayname(Name of suite)
-- %suitepath(all.globaltests)
--%test
procedure foo;
--%beforeeach
procedure foo2;
--test comment
-- wrong comment
/*
describtion of the procedure
*/
--%beforeeach(key=testval)
PROCEDURE foo3(a_value number default null);
--%all
function foo4(a_val number default null
, a_par varchar2 default := ''asdf'');
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', null, null ),
ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null ),
ut3_develop.ut_annotation( 6, 'test', null, 'foo' ),
ut3_develop.ut_annotation( 10, 'beforeeach', null,'foo2' ),
ut3_develop.ut_annotation( 20, 'beforeeach', 'key=testval','foo3' ),
ut3_develop.ut_annotation( 23, 'all', null,'foo4' )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure no_procedure_annotation is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
-- %suite
-- %displayname(Name of suite)
-- %suitepath(all.globaltests)
procedure foo;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', null, null ),
ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure parse_accessible_by is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt accessible by (foo) AS
-- %suite
-- %displayname(Name of suite)
-- %suitepath(all.globaltests)
procedure foo;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', null, null ),
ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure complex_package_declaration is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt
ACCESSIBLE BY (calling_proc)
authid current_user
AS
-- %suite
-- %displayname(Name of suite)
-- %suitepath(all.globaltests)
procedure foo;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 5, 'suite', null, null ),
ut3_develop.ut_annotation( 6, 'displayname', 'Name of suite', null ),
ut3_develop.ut_annotation( 7, 'suitepath', 'all.globaltests', null )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure complex_text is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
-- %suite
--%displayname(name = Name of suite)
-- %suitepath(key=all.globaltests,key2=foo,"--%some text")
procedure foo;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', null, null ),
ut3_develop.ut_annotation( 3, 'displayname', 'name = Name of suite', null ),
ut3_develop.ut_annotation( 4, 'suitepath', 'key=all.globaltests,key2=foo,"--%some text"', null )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure ignore_annotations_in_comments is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
/*
Some comment
-- inlined
-- %ignored
*/
-- %suite
--%displayname(Name of suite)
-- %suitepath(all.globaltests)
procedure foo;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 7, 'suite', null, null ),
ut3_develop.ut_annotation( 8, 'displayname', 'Name of suite', null ),
ut3_develop.ut_annotation( 9, 'suitepath', 'all.globaltests', null )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure ignore_wrapped_package is
l_source dbms_preprocessor.source_lines_t;
l_actual ut3_develop.ut_annotations;
begin
--Arrange
l_source(1) := 'create or replace PACKAGE tst_wrapped_pck wrapped
a000000
369
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
9
34 6d
bg9Jaf2KguofrwaqloE8yvbggKcwg5m49TOf9b9cFj7R9JaW8lYWWi70llr/K6V0iwlp5+eb
v58yvbLAXLi9gYHwoIvAgccti+Cmpg0DKLY=
-- %some_annotation_like_text
';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source,'PACKAGE');
--Assert
ut.expect(anydata.convertCollection(l_actual)).to_be_empty();
end;
procedure brackets_in_desc is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
-- %suite(Name of suite (including some brackets) and some more text)
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', 'Name of suite (including some brackets) and some more text', null )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure test_space_before_annot_params is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
/*
Some comment
-- inlined
*/
-- %suite
-- %suitepath (all.globaltests)
procedure foo;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 6, 'suite', null, null ),
ut3_develop.ut_annotation( 7, 'suitepath', 'all.globaltests', null )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure test_windows_newline
as
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
-- %suite
-- %displayname(Name of suite)' || chr(13) || chr(10)
|| ' -- %suitepath(all.globaltests)
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', null, null ),
ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure test_annot_very_long_name
as
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE very_long_procedure_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_did_it AS
-- %suite
-- %displayname(Name of suite)
-- %suitepath(all.globaltests)
--%test
procedure very_long_procedure_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_dit_it;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', null, null ),
ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null ),
ut3_develop.ut_annotation( 6, 'test', null, 'very_long_procedure_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_dit_it' )
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
procedure test_upper_annot is
l_source clob;
l_actual ut3_develop.ut_annotations;
l_expected ut3_develop.ut_annotations;
begin
l_source := 'PACKAGE test_tt AS
-- %SUITE
-- %DISPLAYNAME(Name of suite)
-- %SUITEPATH(all.globaltests)
-- %ANN1(Name of suite)
-- %ANN2(all.globaltests)
--%TEST
procedure foo;
-- %ANN3(Name of suite)
-- %ANN4(all.globaltests)
--%TEST
procedure bar;
END;';
--Act
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source);
--Assert
l_expected := ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', null, null ),
ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null ),
ut3_develop.ut_annotation( 6, 'ann1', 'Name of suite', null ),
ut3_develop.ut_annotation( 7, 'ann2', 'all.globaltests', null ),
ut3_develop.ut_annotation( 9, 'test', null, 'foo'),
ut3_develop.ut_annotation( 12, 'ann3', 'Name of suite', null ),
ut3_develop.ut_annotation( 13, 'ann4', 'all.globaltests', null ),
ut3_develop.ut_annotation( 15, 'test', null, 'bar')
);
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
end;
end test_annotation_parser;
/
| 29.350649 | 182 | 0.685841 |
85b4209fb34850f98a5d52b2b477eaaf270f2186 | 338 | js | JavaScript | src/App.js | kevin940726/happy-birthday-to-shy | 100b9850d3633d24903ddf10219fb74eaba3acb8 | [
"MIT"
] | 3 | 2018-01-06T06:03:05.000Z | 2018-01-07T15:18:13.000Z | src/App.js | kevin940726/happy-birthday-to-shy | 100b9850d3633d24903ddf10219fb74eaba3acb8 | [
"MIT"
] | null | null | null | src/App.js | kevin940726/happy-birthday-to-shy | 100b9850d3633d24903ddf10219fb74eaba3acb8 | [
"MIT"
] | null | null | null | import React from 'react';
import HappyBirthday from './HappyBirthday';
import Olaf from './Olaf';
import './App.css';
import { BACKGROUND } from './constants';
const App = () => (
<main
className="App"
style={{
backgroundColor: BACKGROUND,
}}
>
<HappyBirthday />
<Olaf />
</main>
);
export default App;
| 16.9 | 44 | 0.609467 |
1768f45dda3c8d5696da6f98e2fd58be5ba042a8 | 7,567 | lua | Lua | [creativity]/AURrealestate/loading.lua | OwningCurtX/AuroraRPG | f76a4aad25ccc8790e42b2f23dfa2dc304e34fb6 | [
"Apache-2.0"
] | 1 | 2020-04-18T20:43:16.000Z | 2020-04-18T20:43:16.000Z | [creativity]/AURrealestate/loading.lua | OwningCurtX/AuroraRPG | f76a4aad25ccc8790e42b2f23dfa2dc304e34fb6 | [
"Apache-2.0"
] | 1 | 2019-10-20T08:41:34.000Z | 2019-10-20T08:41:34.000Z | [creativity]/AURrealestate/loading.lua | OwningCurtX/AuroraRPG | f76a4aad25ccc8790e42b2f23dfa2dc304e34fb6 | [
"Apache-2.0"
] | null | null | null | cache = {}
odata = {
lod = {},
object = {},
texture = {},
shader = {},
data = {},
}
zone_objects = {
["zone1"] = {
--Exterior Walls
{ "2941.4,-1549.1,12.1", "0,90,0", 1462, "brick_wall"},
{ "2951.3,-1559.2,17.1", "0,90,90", 1462, "brick_wall"},
{ "2951.3,-1559.2,12.1", "0,90,90", 1462, "brick_wall"},
{ "2941.4,-1549.1,17.1", "0,90,0", 1462, "brick_wall"},
{ "2951.3,-1539.1,12.1", "0,90,90", 1462, "brick_wall"},
{ "2951.3,-1539.1,17.1", "0,90,90", 1462, "brick_wall"},
{ "2961.2,-1549.1,17.1", "0,90,0", 1462, "brick_wall"},
{ "2961.2,-1554.1,12.1", "0,90,0", 1467, "brick_wall"},
-- Glass Roof
{ "2946.5,-1554.1,19.5", "0,0,0", 2670, "wood1"},
{ "2946.5,-1544.3,19.5", "0,0,0", 2670, "wood1"},
{ "2956.3,-1544.3,19.5", "0,0,0", 2670, "wood1"},
{ "2956.3,-1554.1,19.5", "0,0,0", 2670, "wood1"},
-- 1st Floor Walls
{ "2956.1,-1549.1,12", "0,90,90", 1466, "wood2"},
{ "2951.1,-1546.7,12.1", "0,90,0", 2671, "wood2"},
{ "2951.1,-1541.7,12.1", "0,90,0", 1464, "wood2"},
-- Floors of 1st Floor
{ "2956.3,-1544.1,9.7", "0,0,0", 1469, "wood1"},
{ "2946.3,-1544.2,9.7", "0,0,0", 1469, "blucarp"},
{ "2946.1,-1554.2,9.7", "0,0,0", 1469, "blucarp"},
{ "2956.1,-1554.1,9.7", "0,0,0", 1469, "blacktile"},
-- Staircase
{ "2953.8,-1547.9,13.2", "0,0,270", 3056, "wood2"},
{ "2958.5,-1547.9,10.4", "0,0,270", 3056, "wood2"},
-- 2nd Floor Walls
{ "2956.1,-1549.1,17", "0,90,90", 1466, "wood2"},
{ "2946.3,-1544.2,14.7", "0,0,0", 1469, "wood2"},
{ "2946.1,-1554.2,14.7", "0,0,0", 1469, "wood2"},
{ "2956.1,-1554.1,14.7", "0,0,0", 1469, "wood2"},
{ "2951.2,-1541.7,16.8", "0,90,0", 1465, "wood2"},
{ "2951.2,-1545.4,15.5", "90,20.705,69.295", 1329, "wood2"},
{ "2951.2,-1545.4,17", "90,15.501,74.494", 1329, "wood2"},
{ "2951.2,-1545.4,18.5", "90,13.259,76.73", 1329, "wood2"},
{ "2951.2,-1547.8,18.5", "90,8.385,81.598", 1329, "wood2"},
-- Windows
{ "2961.2,-1554.1,12.1", "0,0,90", 1549, "carbon"},
{ "2961.2,-1554.1,17.1", "0,0,90", 1549, "carbon"},
{ "2961.3,-1544.1,17.1", "0,0,90", 1549, "carbon"},
{ "2956.3,-1559.2,17.1", "0,0,0", 1549, "carbon"},
{ "2946.3,-1559.2,17.1", "0,0,0", 1549, "carbon"},
{ "2946.3,-1539.2,17.1", "0,0,0", 1549, "carbon"},
{ "2941.5,-1554.1,17.1", "0,0,90", 1549, "carbon"},
{ "2941.5,-1544.1,17.1", "0,0,90", 1549, "carbon"},
{ "2941.5,-1554.1,12.1", "0,0,90", 1549, "carbon"},
{ "2941.5,-1544.1,12.1", "0,0,90", 1549, "carbon"},
{ "2946.3,-1539.2,12.1", "0,0,0", 1549, "carbon"},
{ "2956.3,-1539.2,12.1", "0,0,0", 1549, "carbon"},
{ "2956.3,-1539.2,17.1", "0,0,0", 1549, "carbon"},
{ "2956.3,-1559.2,12.1", "0,0,0", 1549, "carbon"},
{ "2946.3,-1559.2,12.1", "0,0,0", 1549, "carbon"},
{ "2951.2,-1542.9,16.8", "0,0,90", 1549, "carbon"},
},
}
addEventHandler( "onClientResourceStart", resourceRoot,
function()
-- loadAllBuildings()
end
)
addEvent( "AURrealestate.pushObjectsToClient", true)
addEventHandler( "AURrealestate.pushObjectsToClient", root,
function( objectString)
if objectString ~= "" then
buildStructure( objectString)
end
end
)
function getZoneCache( zone)
if cache[zone] then
return cache[zone]
else
return false
end
end
local viewingIDS = false
addCommandHandler( "viewIDFrame",
function()
if viewingIDS then
viewingIDS = false
else
viewingIDS = true
end
end
)
addEventHandler( "onClientRender", root,
function()
if not viewingIDS then return end
local pX, pY, pZ = getElementPosition( localPlayer)
local zone = getZoneCache( "zone1")
if zone then
for i , object in ipairs ( zone) do
local x, y, z = getElementPosition( object)
local sX, sY = getScreenFromWorldPosition( x, y, z)
if sX and sY then
dxDrawText( getObjectData( object, "zonename").." - "..getObjectData( object, "shaderTexture"), sX, sY, sX, sY)
end
end
end
end
)
dbdata = {}
function buildStructure( theString)
local stringdata = split( theString, "@")
local theString = stringdata[1]
local zonename = stringdata[2]
local objectString = split( theString, ";")
for i, objectData in ipairs ( objectString) do
local objectValues = split( objectData, "|")
local posData = split( objectValues[1], ",")
local rotData = split( objectValues[2], ",")
local x, y, z = posData[1], posData[2], posData[3]
local rX, rY, rZ = rotData[1], rotData[2], rotData[3]
local materialID = tonumber( objectValues[3])
local textureName = tostring( objectValues[4])
if oldIDreplacer[materialID] then
materialID = oldIDreplacer[materialID]
else
materialID = materialID
end
odata.object[i] = createObject( materialID, x, y, z, rX, rY, rZ)
setElementFrozen( odata.object[i], true)
setElementDoubleSided( odata.object[i], true)
setObjectBreakable( odata.object[i], false)
if not cache[zonename] then
cache[zonename] = {}
end
table.insert( cache[zonename], odata.object[i])
if not dbdata[zonename] then
dbdata[zonename] = {}
end
table.insert( dbdata[zonename], { objectValues[1], objectValues[2], materialID, textureName})
getZoneCache( zonename)
setObjectData( odata.object[i], "shaderTexture", textureName)
setObjectData( odata.object[i], "streaming", true)
setObjectData( odata.object[i], "zonename", zonename)
setObjectData( odata.object[i], "objectNumber", i)
applyCustomTexture( odata.object[i], textureName)
setTimer( checkStream, 1000, 0, odata.object[i])
end
end
local saveString = ""
function saveStructure( zone)
local cacheTable = getZoneCache( "zone1")
for i, object in ipairs ( cacheTable) do
local x, y, z = getElementPosition( object)
local rX, rY, rZ = getElementRotation( object)
local posData = x..","..y..","..z
local rotData = rX..","..rY..","..rZ
local materialID = getElementModel( object)
local textureName = getObjectData( object, "shaderTexture")
--"2941.4,-1549.1,12.1|0,90,0|1462|brick_wall;"
saveString = saveString..posData.."|"..rotData.."|"..materialID.."|"..textureName..";"
end
saveString = ""
end
addEventHandler( "onClientResourceStop", resourceRoot, saveStructure)
--[[function loadAllBuildings()
for zonename, zone in pairs ( zone_objects) do
--outputChatBox( "test")
for i, object in ipairs ( zone) do
local posData = split(object[1], ",")
local rotData = split(object[2], ",")
local x, y, z = posData[1], posData[2], posData[3]
local rX, rY, rZ = rotData[1], rotData[2], rotData[3]
local materialID = tonumber( object[3])
local textureName = tostring( object[4])
--odata.lod[i] = createObject( materialID, x, y, z, rX, rY, rZ, true)
if oldIDreplacer[materialID] then
materialID = oldIDreplacer[materialID]
else
materialID = materialID
end
odata.object[i] = createObject( materialID, x, y, z, rX, rY, rZ)
setElementFrozen( odata.object[i], true)
setElementDoubleSided( odata.object[i], true)
setObjectBreakable( odata.object[i], false)
if not cache[zonename] then
cache[zonename] = {}
end
table.insert( cache[zonename], odata.object[i])
if not dbdata[zonename] then
dbdata[zonename] = {}
end
table.insert( dbdata[zonename], { object[1], object[2], materialID, textureName})
getZoneCache( zonename)
setObjectData( odata.object[i], "shaderTexture", textureName)
setObjectData( odata.object[i], "streaming", true)
setObjectData( odata.object[i], "zonename", zonename)
--setTimer( applyCustomTexture, 10+(i*50), 1, odata.object[i], textureName)
applyCustomTexture( odata.object[i], textureName)
setTimer( checkStream, 1000, 0, odata.object[i])
end
end
end]]-- | 33.482301 | 116 | 0.627065 |
ddaeb1ffd95b5a4e6a603d4214a70a58e6aeed41 | 1,952 | php | PHP | Projects/index.php | Trilocode-Technology/trilo | 386f84a3e0a4b8108ec453321f5fdb4f7bbe76af | [
"BSD-3-Clause"
] | null | null | null | Projects/index.php | Trilocode-Technology/trilo | 386f84a3e0a4b8108ec453321f5fdb4f7bbe76af | [
"BSD-3-Clause"
] | null | null | null | Projects/index.php | Trilocode-Technology/trilo | 386f84a3e0a4b8108ec453321f5fdb4f7bbe76af | [
"BSD-3-Clause"
] | null | null | null | <?php include_once('header.php'); ?>
<!-- banner -->
<div class="banner">
<h2>Projects</h2>
<p><a href="index.html">Home »</a> Projects </p>
</div>
<!--//banner -->
<!-- Portfolio -->
<div class="portfolio w3layouts agileits" id="portfolio">
<div class="container">
<ul class="portfolio-categ filter">
<li class="port-filter all active">
<a href="#">All</a>
</li>
<li class="Website">
<a href="#" title="Websites">Websites</a>
</li>
<li class="Android">
<a href="#" title="Android App">Android App</a>
</li>
<li class="Desktop">
<a href="#" title="Desktop App">Desktop App</a>
</li>
<li class="Ecommerce">
<a href="#" title="E-Commerce Website">E-Commerce Website</a>
</li>
<li class="Demo">
<a href="#" title="Demo App">Demo App</a>
</li>
</ul>
<ul class="portfolio-area">
<?php
include_once("../connection.php");
$sql=@mysqli_query($con,"SELECT * FROM projects") or die(mysqli_error($con));
while($row=mysqli_fetch_array($sql,MYSQLI_ASSOC))
{
?>
<li class="portfolio-item2" data-id="id-6" data-type="<?php echo $row['category']; ?>">
<div>
<span class="image-block">
<?php
if($row['link']==""){
?>
<a class="image-zoom" href="<?php echo $row['link']; ?>">
<?php
}
else{
?>
<a class="image-zoom" href="<?php echo $row['link']; ?>" target="_blank">
<?php } ?>
<figure >
<img src="<?php echo $row['image']; ?>" class="img-responsive w3layouts agileits" alt="Corporation">
<figcaption>
<h3><?php echo $row['title']; ?></h3>
</figcaption>
</figure>
</a><h4 style="text-align: center;"><?php echo $row['title']; ?></h4>
</span>
</div>
</li>
<?php }?>
<div class="column-clear"></div>
</ul>
<!--end portfolio-area -->
</div>
</div>
<!-- //Portfolio -->
<?php include_once('footer.php'); ?> | 26.739726 | 109 | 0.533811 |
b3f431a156886d09a2038d2d90fcbb9772d4173d | 2,107 | rb | Ruby | data/train/ruby/b3f431a156886d09a2038d2d90fcbb9772d4173dcalculates_controller.rb | aliostad/deep-learning-lang-detection | d6b031f3ebc690cf2ffd0ae1b08ffa8fb3b38a62 | [
"MIT"
] | 84 | 2017-10-25T15:49:21.000Z | 2021-11-28T21:25:54.000Z | data/train/ruby/b3f431a156886d09a2038d2d90fcbb9772d4173dcalculates_controller.rb | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 5 | 2018-03-29T11:50:46.000Z | 2021-04-26T13:33:18.000Z | data/train/ruby/b3f431a156886d09a2038d2d90fcbb9772d4173dcalculates_controller.rb | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 24 | 2017-11-22T08:31:00.000Z | 2022-03-27T01:22:31.000Z | class CalculatesController < ApplicationController
before_action :set_calculate, only: [:show, :edit, :update, :destroy]
# GET /calculates
# GET /calculates.json
def index
@calculates = Calculate.order('spent_on')
@calculate_per_day = @calculates.group_by { |c| c.spent_on.beginning_of_day }
end
# GET /calculates/1
# GET /calculates/1.json
def show
end
# GET /calculates/new
def new
@calculate = Calculate.new
end
# GET /calculates/1/edit
def edit
end
# POST /calculates
# POST /calculates.json
def create
@calculate = Calculate.new(calculate_params)
respond_to do |format|
if @calculate.save
format.html { redirect_to @calculate, notice: 'Calculate was successfully created.' }
format.json { render :show, status: :created, location: @calculate }
else
format.html { render :new }
format.json { render json: @calculate.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /calculates/1
# PATCH/PUT /calculates/1.json
def update
respond_to do |format|
if @calculate.update(calculate_params)
format.html { redirect_to @calculate, notice: 'Calculate was successfully updated.' }
format.json { render :show, status: :ok, location: @calculate }
else
format.html { render :edit }
format.json { render json: @calculate.errors, status: :unprocessable_entity }
end
end
end
# DELETE /calculates/1
# DELETE /calculates/1.json
def destroy
@calculate.destroy
respond_to do |format|
format.html { redirect_to calculates_url, notice: 'Calculate was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_calculate
@calculate = Calculate.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def calculate_params
params.require(:calculate).permit(:name, :money_spent, :spent_on, :daily_sum)
end
end
| 27.012821 | 97 | 0.677741 |
04c9a122b454247815089221a16d38d57c7d2f1b | 4,411 | java | Java | common-json/src/test/java/org/duracloud/common/json/JaxbJsonSerializerTest.java | SachithMayantha/duracloud | b2fc68f76477b70f2d291c70172d7b6845149856 | [
"Apache-2.0"
] | 1 | 2018-05-11T09:34:37.000Z | 2018-05-11T09:34:37.000Z | common-json/src/test/java/org/duracloud/common/json/JaxbJsonSerializerTest.java | SachithMayantha/duracloud | b2fc68f76477b70f2d291c70172d7b6845149856 | [
"Apache-2.0"
] | null | null | null | common-json/src/test/java/org/duracloud/common/json/JaxbJsonSerializerTest.java | SachithMayantha/duracloud | b2fc68f76477b70f2d291c70172d7b6845149856 | [
"Apache-2.0"
] | null | null | null | /*
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://duracloud.org/license/
*/
package org.duracloud.common.json;
import java.util.List;
import org.duracloud.common.model.SimpleCredential;
import org.duracloud.common.test.StorageProviderCredential;
import org.duracloud.common.test.TestConfig;
import org.duracloud.common.test.TestEndPoint;
import org.junit.Assert;
import org.junit.Test;
/**
* @author Bill Branan
* Date: 7/29/13
*/
public class JaxbJsonSerializerTest {
private String jsonTestConfig;
public JaxbJsonSerializerTest() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append(" \"providerCredentials\" : [ {");
sb.append(" \"type\" : \"AMAZON_S3\",");
sb.append(" \"credential\" : {");
sb.append(" \"username\" : \"amazon-user\",");
sb.append(" \"password\" : \"amazon-pass\"");
sb.append(" }");
sb.append(" }, {");
sb.append(" \"type\" : \"RACKSPACE\",");
sb.append(" \"credential\" : {");
sb.append(" \"username\" : \"rack-user\",");
sb.append(" \"password\" : \"rack-pass\"");
sb.append(" }");
sb.append(" } ],");
sb.append(" \"queueName\": \"queue-name\",");
sb.append(" \"testEndPoint\" : { ");
sb.append(" \"host\" : \"localhost\",");
sb.append(" \"port\" : \"8080\"");
sb.append(" }, ");
sb.append(" \"userCredential\" : { ");
sb.append(" \"username\" : \"testuser\",");
sb.append(" \"password\" : \"password\"");
sb.append(" },");
sb.append(" \"adminCredential\" : { ");
sb.append(" \"username\" : \"testuser\",");
sb.append(" \"password\" : \"password\"");
sb.append(" }, ");
sb.append(" \"rootCredential\" : { ");
sb.append(" \"username\" : \"testuser\",");
sb.append(" \"password\" : \"password\"");
sb.append(" }");
sb.append("}");
jsonTestConfig = sb.toString();
}
@Test
public void testDeSerialize() throws Exception {
JaxbJsonSerializer<TestConfig> serializer =
new JaxbJsonSerializer<>(TestConfig.class);
TestConfig desCreds = serializer.deserialize(jsonTestConfig);
List<StorageProviderCredential> credList =
desCreds.getProviderCredentials();
Assert.assertEquals(2, credList.size());
Assert.assertEquals("amazon-user",
credList.get(0).getCredential().getUsername());
Assert.assertEquals("rack-user",
credList.get(1).getCredential().getUsername());
Assert.assertEquals("queue-name", desCreds.getQueueName());
}
@Test
public void testSerialize() throws Exception {
JaxbJsonSerializer<TestConfig> serializer =
new JaxbJsonSerializer<>(TestConfig.class);
StorageProviderCredential s3Cred = new StorageProviderCredential(
StorageProviderCredential.ProviderType.AMAZON_S3,
new SimpleCredential("amazon-user", "amazon-pass"));
StorageProviderCredential rackCred = new StorageProviderCredential(
StorageProviderCredential.ProviderType.RACKSPACE,
new SimpleCredential("rack-user", "rack-pass"));
TestConfig testConfig = new TestConfig();
testConfig.addProviderCredential(s3Cred);
testConfig.addProviderCredential(rackCred);
testConfig.setQueueName("queue-name");
testConfig.setTestEndPoint(new TestEndPoint());
testConfig.setAdminCredential(new SimpleCredential("testuser", "password"));
testConfig.setRootCredential(new SimpleCredential("testuser", "password"));
testConfig.setUserCredential(new SimpleCredential("testuser", "password"));
String json = serializer.serialize(testConfig);
// Verify that the resulting json matches the expected value, ignoring
// whitespace.
Assert.assertEquals(jsonTestConfig.replaceAll("\\s", ""),
json.replaceAll("\\s", ""));
}
}
| 39.738739 | 85 | 0.575606 |
f4478dba259a5e8e783d7844737282befd0e3aed | 4,023 | sql | SQL | mebel.sql | AdeSatriyoPujo/CodeIgniter | be055138a851d3ad2a22c5cc9bc10f8f8ef007da | [
"MIT"
] | null | null | null | mebel.sql | AdeSatriyoPujo/CodeIgniter | be055138a851d3ad2a22c5cc9bc10f8f8ef007da | [
"MIT"
] | null | null | null | mebel.sql | AdeSatriyoPujo/CodeIgniter | be055138a851d3ad2a22c5cc9bc10f8f8ef007da | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 03, 2018 at 07:38 AM
-- Server version: 10.1.30-MariaDB
-- PHP Version: 7.2.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `mebel`
--
-- --------------------------------------------------------
--
-- Table structure for table `barang`
--
CREATE TABLE `barang` (
`ID_Barang` int(10) NOT NULL,
`Nmbarang` varchar(20) NOT NULL,
`Jnbarang` varchar(20) NOT NULL,
`Hgbarang` varchar(30) NOT NULL,
`Stbarang` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `barang`
--
INSERT INTO `barang` (`ID_Barang`, `Nmbarang`, `Jnbarang`, `Hgbarang`, `Stbarang`) VALUES
(1, 'Meja', 'Furnitur', '250000', 15),
(2, 'Kursi', 'Furnitur', '200000', 15),
(3, 'Pintu', 'Furnitur', '250000', 15),
(4, 'Jendela', 'Furnitur', '250000', 15),
(5, 'Kusen', 'Furnitur', '170000', 15);
-- --------------------------------------------------------
--
-- Table structure for table `jenisbarang`
--
CREATE TABLE `jenisbarang` (
`Kdjnbarang` int(5) NOT NULL,
`nmjnbarang` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `jenisbarang`
--
INSERT INTO `jenisbarang` (`Kdjnbarang`, `nmjnbarang`) VALUES
(11, 'Furnitur'),
(22, 'Aksesoris'),
(33, 'JenisKayu');
-- --------------------------------------------------------
--
-- Table structure for table `karyawan`
--
CREATE TABLE `karyawan` (
`ID_karyawan` int(5) NOT NULL,
`nmkaryawan` varchar(20) NOT NULL,
`umkaryawan` int(5) NOT NULL,
`almtkaryawan` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `karyawan`
--
INSERT INTO `karyawan` (`ID_karyawan`, `nmkaryawan`, `umkaryawan`, `almtkaryawan`) VALUES
(101, 'Budiono', 25, 'jl.Soekarno-Hatta km.09'),
(102, 'Gunawan', 38, 'jl.Soekarno-Hatta km.09'),
(103, 'Suripto', 40, 'jl.Soekarno-Hatta km.09'),
(104, 'Joko', 28, 'jl.Soekarno-Hatta km.09'),
(105, 'Susilo', 30, 'jl.Soekarno-Hatta km.09');
-- --------------------------------------------------------
--
-- Table structure for table `pelanggan`
--
CREATE TABLE `pelanggan` (
`ID_pelanggan` int(5) NOT NULL,
`Nmpelanggan` varchar(20) NOT NULL,
`tglpembelian` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `pelanggan`
--
INSERT INTO `pelanggan` (`ID_pelanggan`, `Nmpelanggan`, `tglpembelian`) VALUES
(201, 'Dodit', '2018-05-08'),
(202, 'Dian', '2018-05-01'),
(203, 'Sucipto', '2018-05-01'),
(204, 'Beni', '2018-05-05'),
(205, 'Susanti', '2018-05-02');
-- --------------------------------------------------------
--
-- Table structure for table `stok`
--
CREATE TABLE `stok` (
`ID_stok` int(5) NOT NULL,
`nmbarang` varchar(20) NOT NULL,
`jumlah` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `stok`
--
INSERT INTO `stok` (`ID_stok`, `nmbarang`, `jumlah`) VALUES
(1, 'Kusen', 15),
(2, 'Jendela', 15),
(3, 'Kursi', 15),
(4, 'Meja', 15),
(5, 'Kayu Jati', 20);
-- --------------------------------------------------------
--
-- Table structure for table `supplier`
--
CREATE TABLE `supplier` (
`ID_supplier` int(5) NOT NULL,
`nmsupplier` varchar(20) NOT NULL,
`jnsupplier` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `supplier`
--
INSERT INTO `supplier` (`ID_supplier`, `nmsupplier`, `jnsupplier`) VALUES
(123, 'PT.Juragan', 'Kayu'),
(124, 'PT.Sukomulyo', 'Alat dan Bahan');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 24.530488 | 89 | 0.611235 |
891c9f3c13c38ad71a0e21abc3fb13e93211df32 | 9,225 | swift | Swift | PayPlugin/Classes/PostFormWebViewController.swift | wufeiyue/PayPlugin | d76c4f35ea41db147e7feba17d5b608b71b82990 | [
"MIT"
] | 1 | 2019-06-15T02:30:11.000Z | 2019-06-15T02:30:11.000Z | PayPlugin/Classes/PostFormWebViewController.swift | wufeiyue/PayPlugin | d76c4f35ea41db147e7feba17d5b608b71b82990 | [
"MIT"
] | null | null | null | PayPlugin/Classes/PostFormWebViewController.swift | wufeiyue/PayPlugin | d76c4f35ea41db147e7feba17d5b608b71b82990 | [
"MIT"
] | null | null | null | //
// PostFormWebViewController.swift
// Alamofire
//
// Created by 武飞跃 on 2018/8/3.
//
import Foundation
import WebKit
protocol PostFormNavigationViewDelegate: class {
func didBackTapped()
func didCloseTapped()
}
final class PostFormNavigationView: UIView {
weak var delegate: PostFormNavigationViewDelegate?
private var backBtn: UIButton?
private var closeBtn: UIButton?
var titleLab: UILabel!
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
}
func setupView() {
if let imagePath = Bundle.formAssetBundle.path(forResource: "icon_back@2x", ofType: "png", inDirectory: "Images") {
if let back_nor = UIImage(contentsOfFile: imagePath) {
let backBtn = UIButton()
backBtn.setImage(back_nor, for: .normal)
backBtn.addTarget(self, action: #selector(backTapped), for: .touchUpInside)
addSubview(backBtn)
self.backBtn = backBtn
}
}
if let imagePath = Bundle.formAssetBundle.path(forResource: "icon_blackClose@2x", ofType: "png", inDirectory: "Images") {
if let back_nor = UIImage(contentsOfFile: imagePath) {
let closeBtn = UIButton()
closeBtn.setImage(back_nor, for: .normal)
closeBtn.addTarget(self, action: #selector(closeTapped), for: .touchUpInside)
addSubview(closeBtn)
self.closeBtn = closeBtn
}
}
let titleLab = UILabel()
titleLab.textAlignment = .center
titleLab.font = UIFont.boldSystemFont(ofSize: 18)
titleLab.textColor = .black
addSubview(titleLab)
self.titleLab = titleLab
}
override func layoutSubviews() {
super.layoutSubviews()
titleLab.frame.size = CGSize(width: 200, height: 20)
titleLab.center.x = bounds.midX
titleLab.frame.origin.y = bounds.height - titleLab.bounds.height - 9
backBtn?.frame.size = CGSize(width: 30, height: 30)
backBtn?.frame.origin = CGPoint(x: 10, y: bounds.height - 30 - 4)
closeBtn?.frame.size = CGSize(width: 30, height: 30)
if let backBtn = backBtn {
closeBtn?.frame.origin = CGPoint(x: backBtn.frame.maxX + 10, y: bounds.height - 30 - 4)
}
else {
closeBtn?.frame.origin = CGPoint(x: 10, y: bounds.height - 30 - 4)
}
}
@objc
private func backTapped() {
delegate?.didBackTapped()
}
@objc
private func closeTapped() {
delegate?.didCloseTapped()
}
required init?(coder aDecoder: NSCoder) {
return nil
}
}
public final class PostFormWebViewController: UIViewController {
public typealias ResponseCompletion = () -> Void
//初始化实现
public var backAction: ResponseCompletion?
public var loadHTMLString: String = ""
public var baseURL: URL?
public var returnURLString: String = ""
public var javeScript: String?
public var openURLRole: ((URL) -> Bool)!
public var openURLCompletion: ((URL) -> Void)?
public var navigationItemTitle: String = ""
private var backNavigation: WKNavigation?
private var webView: WKWebView!
private var needLoadJSPOST = true
private let configuration: WKWebViewConfiguration = WKWebViewConfiguration()
/// 进度条
private var progressView: UIProgressView!
private var navigationView: PostFormNavigationView!
private var isFirst: Bool = true
override public func viewDidLoad() {
super.viewDidLoad()
setupViews()
}
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print("viewWillAppear")
}
public override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
print("viewWillDisappear")
}
public override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if isFirst {
isFirst = false
let navigationRect = CGRect(x: 0, y: 0, width: view.bounds.width, height: iPhoneXTopInset + 64)
navigationView.frame = navigationRect
let progressRect = CGRect(x: 0, y: navigationRect.maxY, width: view.bounds.width, height: 3)
progressView.frame = progressRect
let webViewRect = CGRect(x: 0, y: progressRect.maxY, width: view.bounds.width, height: view.bounds.height - progressRect.maxY )
webView.frame = webViewRect
}
}
private func setupViews() {
automaticallyAdjustsScrollViewInsets = false
view.backgroundColor = .white
webView = WKWebView(frame: .zero, configuration: configuration)
webView.loadHTMLString(loadHTMLString, baseURL: baseURL)
webView.addObserver(self, forKeyPath: #keyPath(WKWebView.estimatedProgress), options: .new, context: nil)
webView.navigationDelegate = self
webView.backgroundColor = UIColor.init(red: 247/255.0, green: 247/255.0, blue: 247/255.0, alpha: 1)
view.addSubview(webView)
progressView = UIProgressView()
progressView.tintColor = .orange
progressView.trackTintColor = .white
view.addSubview(progressView)
navigationView = PostFormNavigationView(frame: .zero)
navigationView.backgroundColor = .white
navigationView.delegate = self
navigationView.titleLab.text = navigationItemTitle
view.addSubview(navigationView)
}
deinit {
print("已经释放")
}
public func free() {
webView.removeObserver(self, forKeyPath: #keyPath(WKWebView.estimatedProgress))
webView.navigationDelegate = nil
}
override public func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == #keyPath(WKWebView.estimatedProgress) {
progressView.alpha = 1.0
progressView.setProgress(Float(webView.estimatedProgress), animated: true)
if webView.estimatedProgress >= 1.0 {
UIView.animate(withDuration: 0.3, delay: 0.3, options: .curveEaseOut, animations: {
self.progressView.alpha = 0.0
}, completion: { (finfished: Bool) in
self.progressView.setProgress(0.0, animated: false)
})
}
}
}
/// 调用JS发送POST请求
private func postRequestWithJS() {
guard let js = javeScript, js.isEmpty == false else {
return
}
// 调用JS代码
webView.evaluateJavaScript(js) { (_, error) in
if error == nil {
//printLogDebug("----- post 请求成功")
}
}
}
private var iPhoneXTopInset: CGFloat {
if #available(iOS 11, *) {
guard UIScreen.main.nativeBounds.height == 2436 else { return 0 }
return view.safeAreaInsets.top
}
return 0
}
}
extension PostFormWebViewController: PostFormNavigationViewDelegate {
func didBackTapped() {
if webView.canGoBack {
backNavigation = webView.goBack()
webView.reload()
} else {
backAction?()
}
}
func didCloseTapped() {
backAction?()
}
}
extension PostFormWebViewController: WKNavigationDelegate {
// 开始加载时
public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
progressView.isHidden = false
}
/// 即将白屏
public func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
// printLogDebug("------ 白屏了")
}
// 完成加载
public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
// printLogDebug("----- H5页面加载完成")
if needLoadJSPOST {
// 调用使用JS发送POST请求的方法
postRequestWithJS()
// 将Flag置为NO(后面就不需要加载了)
needLoadJSPOST = false
}
//一网通的H5界面不支持goback,猜测原因可能是WKWebView的老问题post请求的body信息丢失,回退之后再做一次刷新暂时可以解决
if let curNavigation = backNavigation, navigation == curNavigation {
webView.reload()
backNavigation = nil
}
}
// 服务器开始请求的时候调用
public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
guard let url = navigationAction.request.url else {
decisionHandler(.cancel)
return
}
if url.absoluteString == returnURLString {
self.backAction?()
}
else if openURLRole(url) {
openURLCompletion?(url)
}
decisionHandler(.allow)
}
}
| 31.377551 | 164 | 0.595556 |
d29a67478ad5155df838f7fcfbfc4107fc4c4f58 | 1,636 | php | PHP | tests/ConsoleTest.php | sebastienheyd/boilerplate-email-editor | daf173aba80d78fd24e8c09e7573e1e730b9a3d9 | [
"MIT"
] | 1 | 2021-04-28T23:28:35.000Z | 2021-04-28T23:28:35.000Z | tests/ConsoleTest.php | sebastienheyd/boilerplate-email-editor | daf173aba80d78fd24e8c09e7573e1e730b9a3d9 | [
"MIT"
] | null | null | null | tests/ConsoleTest.php | sebastienheyd/boilerplate-email-editor | daf173aba80d78fd24e8c09e7573e1e730b9a3d9 | [
"MIT"
] | 2 | 2020-10-11T09:28:53.000Z | 2021-10-04T07:54:46.000Z | <?php
namespace Sebastienheyd\BoilerplateEmailEditor\Tests;
use Symfony\Component\Console\Exception\RuntimeException;
class ConsoleTest extends TestCase
{
public function testEmailLayoutNoName()
{
$this->expectException(RuntimeException::class);
$this->artisan('email:layout');
}
public function testEmailLayoutCreate()
{
$this->artisan('email:layout', ['name' => 'test'])
->expectsOutput('Layout '.self::TEST_APP.'/resources/views/email-layouts/test.blade.php has been generated')
->assertExitCode(0);
$this->assertFileExists(self::TEST_APP.'/resources/views/email-layouts/test.blade.php');
$this->artisan('email:layout', ['name' => 'test'])
->expectsOutput('Layout '.self::TEST_APP.'/resources/views/email-layouts/test.blade.php already exist')
->assertExitCode(0);
}
public function testEmailLayoutDelete()
{
$this->artisan('email:layout', ['--remove' => true, 'name' => 'test'])
->expectsConfirmation('Delete '.self::TEST_APP.'/resources/views/email-layouts/test.blade.php layout?', 'yes')
->expectsOutput('Layout '.self::TEST_APP.'/resources/views/email-layouts/test.blade.php has been deleted')
->assertExitCode(0);
$this->assertFileDoesNotExist(self::TEST_APP.'/resources/views/email-layouts/test.blade.php');
$this->artisan('email:layout', ['--remove' => true, 'name' => 'test'])
->expectsOutput('Layout '.self::TEST_APP.'/resources/views/email-layouts/test.blade.php does not exists')
->assertExitCode(0);
}
}
| 38.952381 | 122 | 0.649144 |
ca087e1e6600f247ed520cf1d3d9a4fd38acd4bd | 239 | java | Java | legend-engine-shared-core/src/main/java/org/finos/legend/engine/shared/core/vault/VaultConfiguration.java | dave-wathen/legend-engine | 65c984c5774c27ac2f83eb957f016ca61010fea1 | [
"Apache-2.0"
] | 32 | 2020-10-19T21:44:25.000Z | 2022-02-14T09:27:50.000Z | legend-engine-shared-core/src/main/java/org/finos/legend/engine/shared/core/vault/VaultConfiguration.java | dave-wathen/legend-engine | 65c984c5774c27ac2f83eb957f016ca61010fea1 | [
"Apache-2.0"
] | 90 | 2020-10-19T11:24:26.000Z | 2022-03-30T12:07:00.000Z | legend-engine-shared-core/src/main/java/org/finos/legend/engine/shared/core/vault/VaultConfiguration.java | dave-wathen/legend-engine | 65c984c5774c27ac2f83eb957f016ca61010fea1 | [
"Apache-2.0"
] | 132 | 2020-10-19T12:10:51.000Z | 2022-03-31T18:44:30.000Z | package org.finos.legend.engine.shared.core.vault;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "_type")
public abstract class VaultConfiguration
{
public String _type;
}
| 23.9 | 61 | 0.790795 |
869dbfddce8f0be78638a261fb9e542b2d843382 | 94 | go | Go | lib/plugin/stockers.go | kmagai/fugo | 7d602007e35ecbb113bd1ff29fd0c7bb34d81179 | [
"MIT"
] | null | null | null | lib/plugin/stockers.go | kmagai/fugo | 7d602007e35ecbb113bd1ff29fd0c7bb34d81179 | [
"MIT"
] | null | null | null | lib/plugin/stockers.go | kmagai/fugo | 7d602007e35ecbb113bd1ff29fd0c7bb34d81179 | [
"MIT"
] | null | null | null | package plugin
// Stockers is a slice of stocks
type Stockers interface {
String() string
}
| 13.428571 | 32 | 0.744681 |
c9b5577bbc95bd5e4d82c9cd5269e96621347d01 | 1,595 | sql | SQL | db.sql | rgbDylan/nodeverse-1 | 02cf6ba291279e3ffc1bab1e2d70f292416bbe11 | [
"Apache-2.0"
] | 1 | 2021-05-10T18:07:04.000Z | 2021-05-10T18:07:04.000Z | db.sql | rgbDylan/nodeverse-1 | 02cf6ba291279e3ffc1bab1e2d70f292416bbe11 | [
"Apache-2.0"
] | null | null | null | db.sql | rgbDylan/nodeverse-1 | 02cf6ba291279e3ffc1bab1e2d70f292416bbe11 | [
"Apache-2.0"
] | 2 | 2021-05-17T17:12:50.000Z | 2021-06-09T15:06:49.000Z | -- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : dim. 16 mai 2021 à 16:45
-- Version du serveur : 8.0.25-0ubuntu0.21.04.1
-- Version de PHP : 7.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de données : `nodeverse`
--
-- --------------------------------------------------------
--
-- Structure de la table `users`
--
CREATE TABLE `users` (
`userid` int NOT NULL,
`username` varchar(255) COLLATE utf8_bin NOT NULL,
`userpass` varchar(255) COLLATE utf8_bin NOT NULL,
`nickname` varchar(255) COLLATE utf8_bin NOT NULL,
`datecreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_bin;
--
-- Déchargement des données de la table `users`
--
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`userid`),
ADD UNIQUE KEY `username` (`username`);
--
-- AUTO_INCREMENT pour les tables déchargées
--
--
-- AUTO_INCREMENT pour la table `users`
--
ALTER TABLE `users`
MODIFY `userid` int NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 23.455882 | 67 | 0.690909 |
6f281818d7f1881ea815352f8670b135a9505c73 | 1,881 | swift | Swift | AKMediaViewer/AKVideoControlView.swift | msavoaia/AKMediaViewer | 479dad09f476dea61a300aa24a52ab80cab179b8 | [
"MIT"
] | 1 | 2016-06-23T04:58:16.000Z | 2016-06-23T04:58:16.000Z | AKMediaViewer/AKVideoControlView.swift | mohsinalimat/AKMediaViewer | 479dad09f476dea61a300aa24a52ab80cab179b8 | [
"MIT"
] | 1 | 2021-02-03T10:43:56.000Z | 2021-02-09T02:38:34.000Z | AKMediaViewer/AKVideoControlView.swift | mohsinalimat/AKMediaViewer | 479dad09f476dea61a300aa24a52ab80cab179b8 | [
"MIT"
] | 1 | 2021-02-01T17:10:25.000Z | 2021-02-01T17:10:25.000Z | //
// AKVideoControlView.swift
// AKMediaViewer
//
// Created by Diogo Autilio on 3/18/16.
// Copyright © 2016 AnyKey Entertainment. All rights reserved.
//
import Foundation
import AVFoundation
import UIKit
public class AKVideoControlView : UIView {
@IBOutlet public var scrubbing: ASBPlayerScrubbing!
@IBOutlet var slider: UISlider!
@IBOutlet var remainingTimeLabel: UILabel!
@IBOutlet var durationLabel: UILabel!
@IBOutlet var playPauseButton: UIButton!
override public func awakeFromNib() {
super.awakeFromNib()
scrubbing.addObserver(self, forKeyPath: "player", options: NSKeyValueObservingOptions.New, context: nil)
}
deinit {
scrubbing.removeObserver(self, forKeyPath: "player")
scrubbing.player.removeObserver(self, forKeyPath: "rate")
}
class func videoControlView() -> AKVideoControlView {
let objects: NSArray = NSBundle.mainBundle().loadNibNamed("AKVideoControlView", owner: nil, options: nil)
return objects.firstObject as! AKVideoControlView
}
// MARK: - IBActions
@IBAction func switchTimeLabel(sender: AnyObject) {
self.remainingTimeLabel.hidden = !self.remainingTimeLabel.hidden
self.durationLabel.hidden = !self.remainingTimeLabel.hidden
}
// MARK: - KVO
override public func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {
if (keyPath == "player") {
if(scrubbing.player != nil) {
scrubbing.player.addObserver(self, forKeyPath: "rate", options: NSKeyValueObservingOptions.New, context: nil)
}
} else {
let player = object as! AVPlayer
playPauseButton.selected = (player.rate != 0)
}
}
} | 34.2 | 164 | 0.662945 |
7da85789f9cc3760dd0d33b6211b9a42b4fbcde3 | 1,743 | kt | Kotlin | app_update/src/main/java/com/inz/z/app_update/view/AbsBaseDialogFragment.kt | Memory-Z/Z_inz | feff01057cf308fcbf9f1ebf880b9a114badf970 | [
"Apache-2.0"
] | 2 | 2019-09-09T05:56:47.000Z | 2020-04-14T09:19:29.000Z | app_update/src/main/java/com/inz/z/app_update/view/AbsBaseDialogFragment.kt | Memory-Z/Z_inz | feff01057cf308fcbf9f1ebf880b9a114badf970 | [
"Apache-2.0"
] | null | null | null | app_update/src/main/java/com/inz/z/app_update/view/AbsBaseDialogFragment.kt | Memory-Z/Z_inz | feff01057cf308fcbf9f1ebf880b9a114badf970 | [
"Apache-2.0"
] | null | null | null | package com.inz.z.app_update.view
import android.content.Context
import android.os.Bundle
import androidx.annotation.LayoutRes
import androidx.fragment.app.DialogFragment
import android.view.*
import com.inz.z.app_update.R
/**
*
* @author Zhenglj
* @version 1.0.0
* Create by inz in 2019/3/13 15:14.
*/
abstract class AbsBaseDialogFragment : androidx.fragment.app.DialogFragment() {
protected var mContext: Context? = null
protected var mView: View? = null
@LayoutRes
protected abstract fun getLayoutId(): Int
protected abstract fun initView()
protected abstract fun initData()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_FRAME, R.style.AppUpdate_NoTitleDialog)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(getLayoutId(), null, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mView = view
mContext = context
val window = dialog.window
window?.setBackgroundDrawableResource(R.color.app_update_transparent)
val lp = window?.attributes
lp?.width = WindowManager.LayoutParams.MATCH_PARENT
lp?.gravity = Gravity.CENTER
window?.attributes = lp
initView()
}
override fun onStart() {
super.onStart()
dialog.window?.attributes?.gravity = Gravity.CENTER
initData()
}
override fun onDetach() {
super.onDetach()
mContext = null
}
} | 27.234375 | 102 | 0.682157 |
0142778f6b8ca8bad8ba4611dd6e7c987738a6c2 | 5,512 | swift | Swift | PhoneNumberKit/Constants.swift | iwooltd/PhoneNumberKit | 062e2bcd8044895591ec6b5299d2ec611ed7d771 | [
"MIT"
] | 2 | 2018-05-11T19:13:03.000Z | 2018-09-10T18:53:18.000Z | PhoneNumberKit/Constants.swift | joshdholtz/PhoneNumberKit | b2da36c06405a46c255cf2ce120ce69fa626e2e9 | [
"MIT"
] | null | null | null | PhoneNumberKit/Constants.swift | joshdholtz/PhoneNumberKit | b2da36c06405a46c255cf2ce120ce69fa626e2e9 | [
"MIT"
] | 2 | 2019-11-28T16:34:38.000Z | 2019-12-08T21:48:04.000Z | //
// Constants.swift
// PhoneNumberKit
//
// Created by Roy Marmelstein on 25/10/2015.
// Copyright © 2015 Roy Marmelstein. All rights reserved.
//
import Foundation
// MARK: Private Enums
enum PhoneNumberCountryCodeSource {
case numberWithPlusSign
case numberWithIDD
case numberWithoutPlusSign
case defaultCountry
}
// MARK: Public Enums
/**
Enumeration for parsing error types
- GeneralError: A general error occured.
- InvalidCountryCode: A country code could not be found or the one found was invalid
- NotANumber: The string provided is not a number
- TooLong: The string provided is too long to be a valid number
- TooShort: The string provided is too short to be a valid number
- Deprecated: The method used was deprecated
- metadataNotFound: PhoneNumberKit was unable to read the included metadata
*/
public enum PhoneNumberError: Error {
case generalError
case invalidCountryCode
case notANumber
case unknownType
case tooLong
case tooShort
case deprecated
case metadataNotFound
}
extension PhoneNumberError: LocalizedError {
public var errorDescription: String? {
switch self {
case .generalError: return NSLocalizedString("An error occured whilst validating the phone number.", comment: "")
case .invalidCountryCode: return NSLocalizedString("The country code is invalid.", comment: "")
case .notANumber: return NSLocalizedString("The number provided is invalid.", comment: "")
case .unknownType: return NSLocalizedString("Phone number type is unknown.", comment: "")
case .tooLong: return NSLocalizedString("The number provided is too long.", comment: "")
case .tooShort: return NSLocalizedString("The number provided is too short.", comment: "")
case .deprecated: return NSLocalizedString("This function is deprecated.", comment: "")
case .metadataNotFound: return NSLocalizedString("Valid metadata is missing.", comment: "")
}
}
}
public enum PhoneNumberFormat {
case e164 // +33689123456
case international // +33 6 89 12 34 56
case national // 06 89 12 34 56
}
/**
Phone number type enumeration
- fixedLine: Fixed line numbers
- mobile: Mobile numbers
- fixedOrMobile: Either fixed or mobile numbers if we can't tell conclusively.
- pager: Pager numbers
- personalNumber: Personal number numbers
- premiumRate: Premium rate numbers
- sharedCost: Shared cost numbers
- tollFree: Toll free numbers
- voicemail: Voice mail numbers
- vOIP: Voip numbers
- uan: UAN numbers
- unknown: Unknown number type
*/
public enum PhoneNumberType: String, Codable {
case fixedLine
case mobile
case fixedOrMobile
case pager
case personalNumber
case premiumRate
case sharedCost
case tollFree
case voicemail
case voip
case uan
case unknown
case notParsed
}
// MARK: Constants
struct PhoneNumberConstants {
static let defaultCountry = "US"
static let defaultExtnPrefix = " ext. "
static let longPhoneNumber = "999999999999999"
static let minLengthForNSN = 2
static let maxInputStringLength = 250
static let maxLengthCountryCode = 3
static let maxLengthForNSN = 16
static let nonBreakingSpace = "\u{00a0}"
static let plusChars = "++"
static let pausesAndWaitsChars = ",;"
static let operatorChars = "*#"
static let validDigitsString = "0-90-9٠-٩۰-۹"
static let digitPlaceholder = "\u{2008}"
static let separatorBeforeNationalNumber = " "
}
struct PhoneNumberPatterns {
// MARK: Patterns
static let firstGroupPattern = "(\\$\\d)"
static let fgPattern = "\\$FG"
static let npPattern = "\\$NP"
static let allNormalizationMappings = ["0":"0", "1":"1", "2":"2", "3":"3", "4":"4", "5":"5", "6":"6", "7":"7", "8":"8", "9":"9", "*": "*", "#": "#", ",": ",", ";": ";"]
static let capturingDigitPattern = "([0-90-9٠-٩۰-۹])"
static let extnPattern = "(?:;ext=([0-90-9٠-٩۰-۹]{1,7})|[ \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|[,xxX##~~;]|int|anexo|int)[:\\..]?[ \\t,-]*([0-90-9٠-٩۰-۹]{1,7})#?|[- ]+([0-90-9٠-٩۰-۹]{1,5})#)$"
static let iddPattern = "^(?:\\+|%@)"
static let formatPattern = "^(?:%@)$"
static let characterClassPattern = "\\[([^\\[\\]])*\\]"
static let standaloneDigitPattern = "\\d(?=[^,}][^,}])"
static let nationalPrefixParsingPattern = "^(?:%@)"
static let prefixSeparatorPattern = "[- ]"
static let eligibleAsYouTypePattern = "^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)+$"
static let leadingPlusCharsPattern = "^[++]+"
static let secondNumberStartPattern = "[\\\\\\/] *x"
static let unwantedEndPattern = "[^0-90-9٠-٩۰-۹A-Za-z#]+$"
static let validStartPattern = "[++0-90-9٠-٩۰-۹]"
static let validPhoneNumberPattern = "^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x\u{2010}-\u{2015}\u{2212}\u{30FC}\u{FF0D}-\u{FF0F} \u{00A0}\u{00AD}\u{200B}\u{2060}\u{3000}()\u{FF08}\u{FF09}\u{FF3B}\u{FF3D}.\\[\\]/~\u{2053}\u{223C}\u{FF5E}*]*[0-9\u{FF10}-\u{FF19}\u{0660}-\u{0669}\u{06F0}-\u{06F9}]){3,}[-x\u{2010}-\u{2015}\u{2212}\u{30FC}\u{FF0D}-\u{FF0F} \u{00A0}\u{00AD}\u{200B}\u{2060}\u{3000}()\u{FF08}\u{FF09}\u{FF3B}\u{FF3D}.\\[\\]/~\u{2053}\u{223C}\u{FF5E}*A-Za-z0-9\u{FF10}-\u{FF19}\u{0660}-\u{0669}\u{06F0}-\u{06F9}]*(?:(?:;ext=([0-90-9٠-٩۰-۹]{1,7})|[ \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|[,xxX##~~;]|int|anexo|int)[:\\..]?[ \\t,-]*([0-90-9٠-٩۰-۹]{1,7})#?|[- ]+([0-90-9٠-٩۰-۹]{1,5})#)?$)?[,;]*$"
}
| 36.263158 | 704 | 0.637155 |
e753ad3f03900208ba3f8e0d030b87ec606d9b66 | 3,234 | js | JavaScript | submissions/CuteShaun/friends-app/js/script.js | CuteShaun/frontend-2019-homeworks | e2e7c166908e8b93dd80dfd1ba91f09c618fba38 | [
"RSA-MD"
] | 20 | 2018-10-28T17:55:29.000Z | 2020-10-15T08:26:10.000Z | submissions/CuteShaun/friends-app/js/script.js | CuteShaun/frontend-2019-homeworks | e2e7c166908e8b93dd80dfd1ba91f09c618fba38 | [
"RSA-MD"
] | 414 | 2018-10-29T19:28:46.000Z | 2019-05-22T10:47:31.000Z | submissions/CuteShaun/friends-app/js/script.js | CuteShaun/frontend-2019-homeworks | e2e7c166908e8b93dd80dfd1ba91f09c618fba38 | [
"RSA-MD"
] | 115 | 2018-10-29T05:49:12.000Z | 2021-02-13T15:13:45.000Z | (function() {
const URL = "https://randomuser.me/api/?results=100";
const main = document.getElementById("card-container");
const sortNameBtn = document.getElementById("sort-name");
const sortAgeBtn = document.getElementById("sort-age");
const filterAgeBtn = document.getElementById("filter-age");
const filterNameBtn = document.getElementById("filter-name");
const ageInput = document.getElementById("age-input");
const nameInput = document.getElementById("name-input");
const resetBtn = document.getElementById("reset");
let DATA = [];
let html;
let sortBy = "asc";
function handleErrors(response) {
if (!response.ok) {
throw Error(response.statusText);
}
return response;
}
fetch(URL)
.then(handleErrors)
.then(response => response.json())
.then(data => {
DATA = data.results;
render(DATA);
});
function appendData(data) {
html = data
.map(item => {
return `<div class="card">
<img class="card__img" src="${
item.picture.large
}" alt="person list item" />
<h2 class="card__name green">${item.name.first} ${item.name.last}</h2>
<div class="card__text">
<p class="card__age"><span class="green">Age: </span>${
item.dob.age
}</p>
<p class="card__email"><span class="green">Email: </span>${
item.email
}</p>
<p class="card__phone"><span class="green">Phone: </span>${
item.phone
}</p>
</div>
</div>`;
})
.join(" ");
main.innerHTML = html;
}
function sort(data, switcher) {
let sortArr = [...data];
let currentValA;
let currentValB;
sortArr.sort((a, b) => {
if (switcher !== "name") {
currentValA = a.dob.age;
currentValB = b.dob.age;
} else {
currentValA = a.name.first.toLowerCase();
currentValB = b.name.first.toLowerCase();
}
if (currentValA < currentValB) return -1;
else if (currentValA > currentValB) return 1;
return 0;
});
sortBy === "desc" ? appendData(sortArr.reverse()) : appendData(sortArr);
if (sortBy === "asc") {
sortBy = "desc";
} else {
sortBy = "asc";
}
}
function filterAge(data) {
let inputVal = ageInput.value;
let filterArr = [...data];
filterArr = filterArr.filter(item => String(item.dob.age) === inputVal);
inputVal === "" ? "" : appendData(filterArr);
}
function filterName(data) {
let inputVal = nameInput.value.toLowerCase();
let filterArr = [...data];
filterArr = filterArr.filter(
item => item.name.first.toLowerCase().indexOf(inputVal) === 0
);
inputVal === "" ? "" : appendData(filterArr);
}
function reset(data) {
appendData(data);
}
function render(data) {
appendData(data);
sortNameBtn.addEventListener("click", () => sort(data, "name"));
sortAgeBtn.addEventListener("click", () => sort(data, "age"));
filterAgeBtn.addEventListener("click", () => filterAge(data));
filterNameBtn.addEventListener("click", () => filterName(data));
resetBtn.addEventListener("click", () => reset(data));
}
})();
| 27.87931 | 78 | 0.584106 |
53d399e21db45622f1b210e478839ac711f6e611 | 59,129 | java | Java | sources/android-28/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java | FTC-10161/FtcRobotController | ee6c7efdff947ccd0abfab64405a91176768e7c0 | [
"MIT"
] | null | null | null | sources/android-28/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java | FTC-10161/FtcRobotController | ee6c7efdff947ccd0abfab64405a91176768e7c0 | [
"MIT"
] | null | null | null | sources/android-28/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java | FTC-10161/FtcRobotController | ee6c7efdff947ccd0abfab64405a91176768e7c0 | [
"MIT"
] | null | null | null | /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.server.wifi.aware;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.wifi.V1_0.NanDataPathChannelCfg;
import android.hardware.wifi.V1_0.NanStatusType;
import android.hardware.wifi.V1_2.NanDataPathChannelInfo;
import android.net.ConnectivityManager;
import android.net.IpPrefix;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.MacAddress;
import android.net.MatchAllNetworkSpecifier;
import android.net.NetworkAgent;
import android.net.NetworkCapabilities;
import android.net.NetworkFactory;
import android.net.NetworkInfo;
import android.net.NetworkRequest;
import android.net.NetworkSpecifier;
import android.net.RouteInfo;
import android.net.wifi.aware.WifiAwareAgentNetworkSpecifier;
import android.net.wifi.aware.WifiAwareManager;
import android.net.wifi.aware.WifiAwareNetworkSpecifier;
import android.net.wifi.aware.WifiAwareUtils;
import android.os.Build;
import android.os.IBinder;
import android.os.INetworkManagementService;
import android.os.Looper;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.wifi.util.WifiPermissionsUtil;
import com.android.server.wifi.util.WifiPermissionsWrapper;
import libcore.util.HexEncoding;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
/**
* Manages Aware data-path lifetime: interface creation/deletion, data-path setup and tear-down.
* The Aware network configuration is:
* - transport = TRANSPORT_WIFI_AWARE
* - capabilities = NET_CAPABILITY_NOT_VPN
* - network specifier generated by DiscoverySession.createNetworkSpecifier(...) or
* WifiAwareManager.createNetworkSpecifier(...).
*/
public class WifiAwareDataPathStateManager {
private static final String TAG = "WifiAwareDataPathStMgr";
private static final boolean VDBG = false; // STOPSHIP if true
/* package */ boolean mDbg = false;
private static final String AWARE_INTERFACE_PREFIX = "aware_data";
private static final String NETWORK_TAG = "WIFI_AWARE_FACTORY";
private static final String AGENT_TAG_PREFIX = "WIFI_AWARE_AGENT_";
private static final int NETWORK_FACTORY_SCORE_AVAIL = 1;
private static final int NETWORK_FACTORY_BANDWIDTH_AVAIL = 1;
private static final int NETWORK_FACTORY_SIGNAL_STRENGTH_AVAIL = 1;
private final WifiAwareStateManager mMgr;
public NetworkInterfaceWrapper mNiWrapper = new NetworkInterfaceWrapper();
private static final NetworkCapabilities sNetworkCapabilitiesFilter = new NetworkCapabilities();
private final Set<String> mInterfaces = new HashSet<>();
private final Map<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation>
mNetworkRequestsCache = new ArrayMap<>();
private Context mContext;
private WifiAwareMetrics mAwareMetrics;
private WifiPermissionsUtil mWifiPermissionsUtil;
private WifiPermissionsWrapper mPermissionsWrapper;
private Looper mLooper;
private WifiAwareNetworkFactory mNetworkFactory;
public INetworkManagementService mNwService;
// internal debug flag to override API check
/* package */ boolean mAllowNdpResponderFromAnyOverride = false;
public WifiAwareDataPathStateManager(WifiAwareStateManager mgr) {
mMgr = mgr;
}
/**
* Initialize the Aware data-path state manager. Specifically register the network factory with
* connectivity service.
*/
public void start(Context context, Looper looper, WifiAwareMetrics awareMetrics,
WifiPermissionsUtil wifiPermissionsUtil, WifiPermissionsWrapper permissionsWrapper) {
if (VDBG) Log.v(TAG, "start");
mContext = context;
mAwareMetrics = awareMetrics;
mWifiPermissionsUtil = wifiPermissionsUtil;
mPermissionsWrapper = permissionsWrapper;
mLooper = looper;
sNetworkCapabilitiesFilter.clearAll();
sNetworkCapabilitiesFilter.addTransportType(NetworkCapabilities.TRANSPORT_WIFI_AWARE);
sNetworkCapabilitiesFilter
.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED)
.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING)
.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_CONGESTED)
.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
.addCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED);
sNetworkCapabilitiesFilter.setNetworkSpecifier(new MatchAllNetworkSpecifier());
sNetworkCapabilitiesFilter.setLinkUpstreamBandwidthKbps(NETWORK_FACTORY_BANDWIDTH_AVAIL);
sNetworkCapabilitiesFilter.setLinkDownstreamBandwidthKbps(NETWORK_FACTORY_BANDWIDTH_AVAIL);
sNetworkCapabilitiesFilter.setSignalStrength(NETWORK_FACTORY_SIGNAL_STRENGTH_AVAIL);
mNetworkFactory = new WifiAwareNetworkFactory(looper, context, sNetworkCapabilitiesFilter);
mNetworkFactory.setScoreFilter(NETWORK_FACTORY_SCORE_AVAIL);
mNetworkFactory.register();
IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
mNwService = INetworkManagementService.Stub.asInterface(b);
}
private Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation>
getNetworkRequestByNdpId(int ndpId) {
for (Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> entry :
mNetworkRequestsCache.entrySet()) {
if (entry.getValue().ndpId == ndpId) {
return entry;
}
}
return null;
}
private Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation>
getNetworkRequestByCanonicalDescriptor(CanonicalConnectionInfo cci) {
if (VDBG) Log.v(TAG, "getNetworkRequestByCanonicalDescriptor: cci=" + cci);
for (Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> entry :
mNetworkRequestsCache.entrySet()) {
if (VDBG) {
Log.v(TAG, "getNetworkRequestByCanonicalDescriptor: entry=" + entry.getValue()
+ " --> cci=" + entry.getValue().getCanonicalDescriptor());
}
if (entry.getValue().getCanonicalDescriptor().matches(cci)) {
return entry;
}
}
return null;
}
/**
* Create all Aware data-path interfaces which are possible on the device - based on the
* capabilities of the firmware.
*/
public void createAllInterfaces() {
if (VDBG) Log.v(TAG, "createAllInterfaces");
if (mMgr.getCapabilities() == null) {
Log.e(TAG, "createAllInterfaces: capabilities aren't initialized yet!");
return;
}
for (int i = 0; i < mMgr.getCapabilities().maxNdiInterfaces; ++i) {
String name = AWARE_INTERFACE_PREFIX + i;
if (mInterfaces.contains(name)) {
Log.e(TAG, "createAllInterfaces(): interface already up, " + name
+ ", possibly failed to delete - deleting/creating again to be safe");
mMgr.deleteDataPathInterface(name);
// critical to remove so that don't get infinite loop if the delete fails again
mInterfaces.remove(name);
}
mMgr.createDataPathInterface(name);
}
}
/**
* Delete all Aware data-path interfaces which are currently up.
*/
public void deleteAllInterfaces() {
if (VDBG) Log.v(TAG, "deleteAllInterfaces");
onAwareDownCleanupDataPaths();
if (mMgr.getCapabilities() == null) {
Log.e(TAG, "deleteAllInterfaces: capabilities aren't initialized yet!");
return;
}
for (int i = 0; i < mMgr.getCapabilities().maxNdiInterfaces; ++i) {
String name = AWARE_INTERFACE_PREFIX + i;
mMgr.deleteDataPathInterface(name);
}
mMgr.releaseAwareInterface();
}
/**
* Called when firmware indicates the an interface was created.
*/
public void onInterfaceCreated(String interfaceName) {
if (VDBG) Log.v(TAG, "onInterfaceCreated: interfaceName=" + interfaceName);
if (mInterfaces.contains(interfaceName)) {
Log.w(TAG, "onInterfaceCreated: already contains interface -- " + interfaceName);
}
mInterfaces.add(interfaceName);
}
/**
* Called when firmware indicates the an interface was deleted.
*/
public void onInterfaceDeleted(String interfaceName) {
if (VDBG) Log.v(TAG, "onInterfaceDeleted: interfaceName=" + interfaceName);
if (!mInterfaces.contains(interfaceName)) {
Log.w(TAG, "onInterfaceDeleted: interface not on list -- " + interfaceName);
}
mInterfaces.remove(interfaceName);
}
/**
* Response to initiating data-path request. Indicates that request is successful (not
* complete!) and is now in progress.
*
* @param networkSpecifier The network specifier provided as part of the initiate request.
* @param ndpId The ID assigned to the data-path.
*/
public void onDataPathInitiateSuccess(WifiAwareNetworkSpecifier networkSpecifier, int ndpId) {
if (VDBG) {
Log.v(TAG,
"onDataPathInitiateSuccess: networkSpecifier=" + networkSpecifier + ", ndpId="
+ ndpId);
}
AwareNetworkRequestInformation nnri = mNetworkRequestsCache.get(networkSpecifier);
if (nnri == null) {
Log.w(TAG, "onDataPathInitiateSuccess: network request not found for networkSpecifier="
+ networkSpecifier);
mMgr.endDataPath(ndpId);
return;
}
if (nnri.state
!= AwareNetworkRequestInformation.STATE_INITIATOR_WAIT_FOR_REQUEST_RESPONSE) {
Log.w(TAG, "onDataPathInitiateSuccess: network request in incorrect state: state="
+ nnri.state);
mNetworkRequestsCache.remove(networkSpecifier);
mMgr.endDataPath(ndpId);
return;
}
nnri.state = AwareNetworkRequestInformation.STATE_WAIT_FOR_CONFIRM;
nnri.ndpId = ndpId;
}
/**
* Response to an attempt to set up a data-path (on the initiator side).
*
* @param networkSpecifier The network specifier provided as part of the initiate request.
* @param reason Failure reason.
*/
public void onDataPathInitiateFail(WifiAwareNetworkSpecifier networkSpecifier, int reason) {
if (VDBG) {
Log.v(TAG,
"onDataPathInitiateFail: networkSpecifier=" + networkSpecifier + ", reason="
+ reason);
}
AwareNetworkRequestInformation nnri = mNetworkRequestsCache.remove(networkSpecifier);
if (nnri == null) {
Log.w(TAG, "onDataPathInitiateFail: network request not found for networkSpecifier="
+ networkSpecifier);
return;
}
if (nnri.state
!= AwareNetworkRequestInformation.STATE_INITIATOR_WAIT_FOR_REQUEST_RESPONSE) {
Log.w(TAG, "onDataPathInitiateFail: network request in incorrect state: state="
+ nnri.state);
}
mAwareMetrics.recordNdpStatus(reason, networkSpecifier.isOutOfBand(), nnri.startTimestamp);
}
/**
* Notification (unsolicited/asynchronous) that a peer has requested to set up a data-path
* connection with us.
*
* @param pubSubId The ID of the discovery session context for the data-path - or 0 if not
* related to a discovery session.
* @param mac The discovery MAC address of the peer.
* @param ndpId The locally assigned ID for the data-path.
* @return The network specifier of the data-path (or null if none/error)
*/
public WifiAwareNetworkSpecifier onDataPathRequest(int pubSubId, byte[] mac, int ndpId) {
if (VDBG) {
Log.v(TAG,
"onDataPathRequest: pubSubId=" + pubSubId + ", mac=" + String.valueOf(
HexEncoding.encode(mac)) + ", ndpId=" + ndpId);
}
WifiAwareNetworkSpecifier networkSpecifier = null;
AwareNetworkRequestInformation nnri = null;
for (Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> entry :
mNetworkRequestsCache.entrySet()) {
/*
* Checking that the incoming request (from the Initiator) matches the request
* we (the Responder) already have set up. The rules are:
* - The discovery session (pub/sub ID) must match.
* - The peer MAC address (if specified - i.e. non-null) must match. A null peer MAC ==
* accept (otherwise matching) requests from any peer MAC.
* - The request must be pending (i.e. we could have completed requests for the same
* parameters)
*/
if (entry.getValue().pubSubId != 0 && entry.getValue().pubSubId != pubSubId) {
continue;
}
if (entry.getValue().peerDiscoveryMac != null && !Arrays.equals(
entry.getValue().peerDiscoveryMac, mac)) {
continue;
}
if (entry.getValue().state
!= AwareNetworkRequestInformation.STATE_RESPONDER_WAIT_FOR_REQUEST) {
continue;
}
networkSpecifier = entry.getKey();
nnri = entry.getValue();
break;
}
if (nnri == null) {
Log.w(TAG, "onDataPathRequest: can't find a request with specified pubSubId=" + pubSubId
+ ", mac=" + String.valueOf(HexEncoding.encode(mac)));
if (VDBG) {
Log.v(TAG, "onDataPathRequest: network request cache = " + mNetworkRequestsCache);
}
mMgr.respondToDataPathRequest(false, ndpId, "", null, null, false);
return null;
}
if (nnri.peerDiscoveryMac == null) {
// the "accept anyone" request is now specific
nnri.peerDiscoveryMac = mac;
}
nnri.interfaceName = selectInterfaceForRequest(nnri);
if (nnri.interfaceName == null) {
Log.w(TAG,
"onDataPathRequest: request " + networkSpecifier + " no interface available");
mMgr.respondToDataPathRequest(false, ndpId, "", null, null, false);
mNetworkRequestsCache.remove(networkSpecifier);
return null;
}
nnri.state = AwareNetworkRequestInformation.STATE_RESPONDER_WAIT_FOR_RESPOND_RESPONSE;
nnri.ndpId = ndpId;
nnri.startTimestamp = SystemClock.elapsedRealtime();
mMgr.respondToDataPathRequest(true, ndpId, nnri.interfaceName, nnri.networkSpecifier.pmk,
nnri.networkSpecifier.passphrase, nnri.networkSpecifier.isOutOfBand());
return networkSpecifier;
}
/**
* Called on the RESPONDER when the response to data-path request has been completed.
*
* @param ndpId The ID of the data-path (NDP)
* @param success Whether or not the 'RespondToDataPathRequest' operation was a success.
*/
public void onRespondToDataPathRequest(int ndpId, boolean success, int reasonOnFailure) {
if (VDBG) {
Log.v(TAG, "onRespondToDataPathRequest: ndpId=" + ndpId + ", success=" + success);
}
WifiAwareNetworkSpecifier networkSpecifier = null;
AwareNetworkRequestInformation nnri = null;
for (Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> entry :
mNetworkRequestsCache.entrySet()) {
if (entry.getValue().ndpId == ndpId) {
networkSpecifier = entry.getKey();
nnri = entry.getValue();
break;
}
}
if (nnri == null) {
Log.w(TAG, "onRespondToDataPathRequest: can't find a request with specified ndpId="
+ ndpId);
if (VDBG) {
Log.v(TAG, "onRespondToDataPathRequest: network request cache = "
+ mNetworkRequestsCache);
}
return;
}
if (!success) {
Log.w(TAG, "onRespondToDataPathRequest: request " + networkSpecifier
+ " failed responding");
mMgr.endDataPath(ndpId);
mNetworkRequestsCache.remove(networkSpecifier);
mAwareMetrics.recordNdpStatus(reasonOnFailure, networkSpecifier.isOutOfBand(),
nnri.startTimestamp);
return;
}
if (nnri.state
!= AwareNetworkRequestInformation.STATE_RESPONDER_WAIT_FOR_RESPOND_RESPONSE) {
Log.w(TAG, "onRespondToDataPathRequest: request " + networkSpecifier
+ " is incorrect state=" + nnri.state);
mMgr.endDataPath(ndpId);
mNetworkRequestsCache.remove(networkSpecifier);
return;
}
nnri.state = AwareNetworkRequestInformation.STATE_WAIT_FOR_CONFIRM;
}
/**
* Notification (unsolicited/asynchronous) that the data-path (which we've been setting up)
* is possibly (if {@code accept} is {@code true}) ready for use from the firmware's
* perspective - now can do L3 configuration.
*
* @param ndpId Id of the data-path
* @param mac The MAC address of the peer's data-path (not discovery interface). Only
* valid
* if {@code accept} is {@code true}.
* @param accept Indicates whether the data-path setup has succeeded (been accepted) or
* failed (been rejected).
* @param reason If {@code accept} is {@code false} provides a reason code for the
* rejection/failure.
* @param message The message provided by the peer as part of the data-path setup
* process.
* @param channelInfo Lists of channels used for this NDP.
* @return The network specifier of the data-path or a null if none/error.
*/
public WifiAwareNetworkSpecifier onDataPathConfirm(int ndpId, byte[] mac, boolean accept,
int reason, byte[] message, List<NanDataPathChannelInfo> channelInfo) {
if (VDBG) {
Log.v(TAG, "onDataPathConfirm: ndpId=" + ndpId + ", mac=" + String.valueOf(
HexEncoding.encode(mac)) + ", accept=" + accept + ", reason=" + reason
+ ", channelInfo=" + channelInfo);
}
Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> nnriE =
getNetworkRequestByNdpId(ndpId);
if (nnriE == null) {
Log.w(TAG, "onDataPathConfirm: network request not found for ndpId=" + ndpId);
if (accept) {
mMgr.endDataPath(ndpId);
}
return null;
}
WifiAwareNetworkSpecifier networkSpecifier = nnriE.getKey();
AwareNetworkRequestInformation nnri = nnriE.getValue();
// validate state
if (nnri.state != AwareNetworkRequestInformation.STATE_WAIT_FOR_CONFIRM) {
Log.w(TAG, "onDataPathConfirm: invalid state=" + nnri.state);
mNetworkRequestsCache.remove(networkSpecifier);
if (accept) {
mMgr.endDataPath(ndpId);
}
return networkSpecifier;
}
if (accept) {
nnri.state = AwareNetworkRequestInformation.STATE_CONFIRMED;
nnri.peerDataMac = mac;
nnri.channelInfo = channelInfo;
NetworkInfo networkInfo = new NetworkInfo(ConnectivityManager.TYPE_NONE, 0,
NETWORK_TAG, "");
NetworkCapabilities networkCapabilities = new NetworkCapabilities(
sNetworkCapabilitiesFilter);
LinkProperties linkProperties = new LinkProperties();
boolean interfaceUsedByAnotherNdp = isInterfaceUpAndUsedByAnotherNdp(nnri);
if (!interfaceUsedByAnotherNdp) {
try {
mNwService.setInterfaceUp(nnri.interfaceName);
mNwService.enableIpv6(nnri.interfaceName);
} catch (Exception e) { // NwService throws runtime exceptions for errors
Log.e(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri
+ ": can't configure network - "
+ e);
mMgr.endDataPath(ndpId);
nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING;
return networkSpecifier;
}
} else {
if (VDBG) {
Log.v(TAG, "onDataPathConfirm: interface already configured: "
+ nnri.interfaceName);
}
}
if (!mNiWrapper.configureAgentProperties(nnri, nnri.equivalentSpecifiers, ndpId,
networkInfo, networkCapabilities, linkProperties)) {
return networkSpecifier;
}
nnri.networkAgent = new WifiAwareNetworkAgent(mLooper, mContext,
AGENT_TAG_PREFIX + nnri.ndpId,
new NetworkInfo(ConnectivityManager.TYPE_NONE, 0, NETWORK_TAG, ""),
networkCapabilities, linkProperties, NETWORK_FACTORY_SCORE_AVAIL,
nnri);
nnri.networkAgent.sendNetworkInfo(networkInfo);
mAwareMetrics.recordNdpStatus(NanStatusType.SUCCESS, networkSpecifier.isOutOfBand(),
nnri.startTimestamp);
nnri.startTimestamp = SystemClock.elapsedRealtime(); // update time-stamp for duration
mAwareMetrics.recordNdpCreation(nnri.uid, mNetworkRequestsCache);
} else {
if (VDBG) {
Log.v(TAG, "onDataPathConfirm: data-path for networkSpecifier=" + networkSpecifier
+ " rejected - reason=" + reason);
}
mNetworkRequestsCache.remove(networkSpecifier);
mAwareMetrics.recordNdpStatus(reason, networkSpecifier.isOutOfBand(),
nnri.startTimestamp);
}
return networkSpecifier;
}
/**
* Notification (unsolicited/asynchronous) from the firmware that the specified data-path has
* been terminated.
*
* @param ndpId The ID of the terminated data-path.
*/
public void onDataPathEnd(int ndpId) {
if (VDBG) Log.v(TAG, "onDataPathEnd: ndpId=" + ndpId);
Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> nnriE =
getNetworkRequestByNdpId(ndpId);
if (nnriE == null) {
if (VDBG) {
Log.v(TAG, "onDataPathEnd: network request not found for ndpId=" + ndpId);
}
return;
}
tearDownInterfaceIfPossible(nnriE.getValue());
if (nnriE.getValue().state == AwareNetworkRequestInformation.STATE_CONFIRMED
|| nnriE.getValue().state == AwareNetworkRequestInformation.STATE_TERMINATING) {
mAwareMetrics.recordNdpSessionDuration(nnriE.getValue().startTimestamp);
}
mNetworkRequestsCache.remove(nnriE.getKey());
mNetworkFactory.tickleConnectivityIfWaiting();
}
/**
* Notification (unsolicited/asynchronous) from the firmware that the channel for the specified
* NDP ids has been updated.
*/
public void onDataPathSchedUpdate(byte[] peerMac, List<Integer> ndpIds,
List<NanDataPathChannelInfo> channelInfo) {
if (VDBG) {
Log.v(TAG, "onDataPathSchedUpdate: peerMac=" + MacAddress.fromBytes(peerMac).toString()
+ ", ndpIds=" + ndpIds + ", channelInfo=" + channelInfo);
}
for (int ndpId : ndpIds) {
Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> nnriE =
getNetworkRequestByNdpId(ndpId);
if (nnriE == null) {
Log.e(TAG, "onDataPathSchedUpdate: ndpId=" + ndpId + " - not found");
continue;
}
if (!Arrays.equals(peerMac, nnriE.getValue().peerDiscoveryMac)) {
Log.e(TAG, "onDataPathSchedUpdate: ndpId=" + ndpId + ", report NMI="
+ MacAddress.fromBytes(peerMac).toString() + " doesn't match NDP NMI="
+ MacAddress.fromBytes(nnriE.getValue().peerDiscoveryMac).toString());
continue;
}
nnriE.getValue().channelInfo = channelInfo;
}
}
/**
* Called whenever Aware comes down. Clean up all pending and up network requests and agents.
*/
public void onAwareDownCleanupDataPaths() {
if (VDBG) Log.v(TAG, "onAwareDownCleanupDataPaths");
Iterator<Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation>> it =
mNetworkRequestsCache.entrySet().iterator();
while (it.hasNext()) {
tearDownInterfaceIfPossible(it.next().getValue());
it.remove();
}
}
/**
* Called when timed-out waiting for confirmation of the data-path setup (i.e.
* onDataPathConfirm). Started on the initiator when executing the request for the data-path
* and on the responder when received a request for data-path (in both cases only on success
* - i.e. when we're proceeding with data-path setup).
*/
public void handleDataPathTimeout(NetworkSpecifier networkSpecifier) {
if (mDbg) Log.v(TAG, "handleDataPathTimeout: networkSpecifier=" + networkSpecifier);
AwareNetworkRequestInformation nnri = mNetworkRequestsCache.remove(networkSpecifier);
if (nnri == null) {
if (mDbg) {
Log.v(TAG,
"handleDataPathTimeout: network request not found for networkSpecifier="
+ networkSpecifier);
}
return;
}
mAwareMetrics.recordNdpStatus(NanStatusType.INTERNAL_FAILURE,
nnri.networkSpecifier.isOutOfBand(), nnri.startTimestamp);
mMgr.endDataPath(nnri.ndpId);
nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING;
}
private class WifiAwareNetworkFactory extends NetworkFactory {
// Request received while waiting for confirmation that a canonically identical data-path
// (NDP) is in the process of being terminated
private boolean mWaitingForTermination = false;
WifiAwareNetworkFactory(Looper looper, Context context, NetworkCapabilities filter) {
super(looper, context, NETWORK_TAG, filter);
}
public void tickleConnectivityIfWaiting() {
if (mWaitingForTermination) {
if (VDBG) Log.v(TAG, "tickleConnectivityIfWaiting: was waiting!");
mWaitingForTermination = false;
reevaluateAllRequests();
}
}
@Override
public boolean acceptRequest(NetworkRequest request, int score) {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkFactory.acceptRequest: request=" + request + ", score="
+ score);
}
if (!mMgr.isUsageEnabled()) {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkFactory.acceptRequest: request=" + request
+ " -- Aware disabled");
}
return false;
}
if (mInterfaces.isEmpty()) {
Log.w(TAG, "WifiAwareNetworkFactory.acceptRequest: request=" + request
+ " -- No Aware interfaces are up");
return false;
}
NetworkSpecifier networkSpecifierBase =
request.networkCapabilities.getNetworkSpecifier();
if (!(networkSpecifierBase instanceof WifiAwareNetworkSpecifier)) {
Log.w(TAG, "WifiAwareNetworkFactory.acceptRequest: request=" + request
+ " - not a WifiAwareNetworkSpecifier");
return false;
}
WifiAwareNetworkSpecifier networkSpecifier =
(WifiAwareNetworkSpecifier) networkSpecifierBase;
// look up specifier - are we being called again?
AwareNetworkRequestInformation nnri = mNetworkRequestsCache.get(networkSpecifier);
if (nnri != null) {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkFactory.acceptRequest: request=" + request
+ " - already in cache with state=" + nnri.state);
}
if (nnri.state == AwareNetworkRequestInformation.STATE_TERMINATING) {
mWaitingForTermination = true;
return false;
}
// seems to happen after a network agent is created - trying to rematch all
// requests again!?
return true;
}
nnri = AwareNetworkRequestInformation.processNetworkSpecifier(networkSpecifier, mMgr,
mWifiPermissionsUtil, mPermissionsWrapper, mAllowNdpResponderFromAnyOverride);
if (nnri == null) {
Log.e(TAG, "WifiAwareNetworkFactory.acceptRequest: request=" + request
+ " - can't parse network specifier");
return false;
}
// check to see if a canonical version exists
Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> primaryRequest =
getNetworkRequestByCanonicalDescriptor(nnri.getCanonicalDescriptor());
if (primaryRequest != null) {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkFactory.acceptRequest: request=" + request
+ ", already has a primary request=" + primaryRequest.getKey()
+ " with state=" + primaryRequest.getValue().state);
}
if (primaryRequest.getValue().state
== AwareNetworkRequestInformation.STATE_TERMINATING) {
mWaitingForTermination = true;
} else {
primaryRequest.getValue().updateToSupportNewRequest(networkSpecifier);
}
return false;
}
mNetworkRequestsCache.put(networkSpecifier, nnri);
return true;
}
@Override
protected void needNetworkFor(NetworkRequest networkRequest, int score) {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkFactory.needNetworkFor: networkRequest="
+ networkRequest + ", score=" + score);
}
NetworkSpecifier networkSpecifierObj =
networkRequest.networkCapabilities.getNetworkSpecifier();
WifiAwareNetworkSpecifier networkSpecifier = null;
if (networkSpecifierObj instanceof WifiAwareNetworkSpecifier) {
networkSpecifier = (WifiAwareNetworkSpecifier) networkSpecifierObj;
}
AwareNetworkRequestInformation nnri = mNetworkRequestsCache.get(networkSpecifier);
if (nnri == null) {
Log.e(TAG, "WifiAwareNetworkFactory.needNetworkFor: networkRequest="
+ networkRequest + " not in cache!?");
return;
}
if (nnri.state != AwareNetworkRequestInformation.STATE_IDLE) {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkFactory.needNetworkFor: networkRequest="
+ networkRequest + " - already in progress");
// TODO: understand how/when can be called again/while in progress (seems
// to be related to score re-calculation after a network agent is created)
}
return;
}
if (nnri.networkSpecifier.role
== WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_INITIATOR) {
nnri.interfaceName = selectInterfaceForRequest(nnri);
if (nnri.interfaceName == null) {
Log.w(TAG, "needNetworkFor: request " + networkSpecifier
+ " no interface available");
mNetworkRequestsCache.remove(networkSpecifier);
return;
}
mMgr.initiateDataPathSetup(networkSpecifier, nnri.peerInstanceId,
NanDataPathChannelCfg.CHANNEL_NOT_REQUESTED, selectChannelForRequest(nnri),
nnri.peerDiscoveryMac, nnri.interfaceName, nnri.networkSpecifier.pmk,
nnri.networkSpecifier.passphrase, nnri.networkSpecifier.isOutOfBand());
nnri.state =
AwareNetworkRequestInformation.STATE_INITIATOR_WAIT_FOR_REQUEST_RESPONSE;
nnri.startTimestamp = SystemClock.elapsedRealtime();
} else {
nnri.state = AwareNetworkRequestInformation.STATE_RESPONDER_WAIT_FOR_REQUEST;
}
}
@Override
protected void releaseNetworkFor(NetworkRequest networkRequest) {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkFactory.releaseNetworkFor: networkRequest="
+ networkRequest);
}
NetworkSpecifier networkSpecifierObj =
networkRequest.networkCapabilities.getNetworkSpecifier();
WifiAwareNetworkSpecifier networkSpecifier = null;
if (networkSpecifierObj instanceof WifiAwareNetworkSpecifier) {
networkSpecifier = (WifiAwareNetworkSpecifier) networkSpecifierObj;
}
AwareNetworkRequestInformation nnri = mNetworkRequestsCache.get(networkSpecifier);
if (nnri == null) {
Log.e(TAG, "WifiAwareNetworkFactory.releaseNetworkFor: networkRequest="
+ networkRequest + " not in cache!?");
return;
}
if (nnri.networkAgent != null) {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkFactory.releaseNetworkFor: networkRequest="
+ networkRequest + ", nnri=" + nnri
+ ": agent already created - deferring ending data-path to agent"
+ ".unwanted()");
}
return;
}
/*
* Since there's no agent it means we're in the process of setting up the NDP.
* However, it is possible that there were other equivalent requests for this NDP. We
* should keep going in that case.
*/
nnri.removeSupportForRequest(networkSpecifier);
if (nnri.equivalentSpecifiers.isEmpty()) {
if (VDBG) {
Log.v(TAG, "releaseNetworkFor: there are no further requests, networkRequest="
+ networkRequest);
}
if (nnri.ndpId != 0) { // 0 is never a valid ID!
if (VDBG) Log.v(TAG, "releaseNetworkFor: in progress NDP being terminated");
mMgr.endDataPath(nnri.ndpId);
nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING;
} else {
mNetworkRequestsCache.remove(networkSpecifier);
}
} else {
if (VDBG) {
Log.v(TAG, "releaseNetworkFor: equivalent requests exist - not terminating "
+ "networkRequest=" + networkRequest);
}
}
}
}
private class WifiAwareNetworkAgent extends NetworkAgent {
private NetworkInfo mNetworkInfo;
private AwareNetworkRequestInformation mAwareNetworkRequestInfo;
WifiAwareNetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni,
NetworkCapabilities nc, LinkProperties lp, int score,
AwareNetworkRequestInformation anri) {
super(looper, context, logTag, ni, nc, lp, score);
mNetworkInfo = ni;
mAwareNetworkRequestInfo = anri;
}
@Override
protected void unwanted() {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkAgent.unwanted: request=" + mAwareNetworkRequestInfo);
}
mMgr.endDataPath(mAwareNetworkRequestInfo.ndpId);
mAwareNetworkRequestInfo.state = AwareNetworkRequestInformation.STATE_TERMINATING;
// Will get a callback (on both initiator and responder) when data-path actually
// terminated. At that point will inform the agent and will clear the cache.
}
void reconfigureAgentAsDisconnected() {
if (VDBG) {
Log.v(TAG, "WifiAwareNetworkAgent.reconfigureAgentAsDisconnected: request="
+ mAwareNetworkRequestInfo);
}
mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.DISCONNECTED, null, "");
sendNetworkInfo(mNetworkInfo);
}
}
private void tearDownInterfaceIfPossible(AwareNetworkRequestInformation nnri) {
if (VDBG) Log.v(TAG, "tearDownInterfaceIfPossible: nnri=" + nnri);
if (!TextUtils.isEmpty(nnri.interfaceName)) {
boolean interfaceUsedByAnotherNdp = isInterfaceUpAndUsedByAnotherNdp(nnri);
if (interfaceUsedByAnotherNdp) {
if (VDBG) {
Log.v(TAG, "tearDownInterfaceIfPossible: interfaceName=" + nnri.interfaceName
+ ", still in use - not turning down");
}
} else {
try {
mNwService.setInterfaceDown(nnri.interfaceName);
} catch (Exception e) { // NwService throws runtime exceptions for errors
Log.e(TAG, "tearDownInterfaceIfPossible: nnri=" + nnri
+ ": can't bring interface down - " + e);
}
}
}
if (nnri.networkAgent != null) {
nnri.networkAgent.reconfigureAgentAsDisconnected();
}
}
private boolean isInterfaceUpAndUsedByAnotherNdp(AwareNetworkRequestInformation nri) {
for (AwareNetworkRequestInformation lnri : mNetworkRequestsCache.values()) {
if (lnri == nri) {
continue;
}
if (nri.interfaceName.equals(lnri.interfaceName) && (
lnri.state == AwareNetworkRequestInformation.STATE_CONFIRMED
|| lnri.state == AwareNetworkRequestInformation.STATE_TERMINATING)) {
return true;
}
}
return false;
}
/**
* Select one of the existing interfaces for the new network request. A request is canonical
* (otherwise it wouldn't be executed).
*
* Construct a list of all interfaces currently used to communicate to the peer. The remaining
* interfaces are available for use for this request - if none are left then the request should
* fail (signaled to the caller by returning a null).
*/
private String selectInterfaceForRequest(AwareNetworkRequestInformation req) {
SortedSet<String> potential = new TreeSet<>(mInterfaces);
Set<String> used = new HashSet<>();
if (VDBG) {
Log.v(TAG, "selectInterfaceForRequest: req=" + req + ", mNetworkRequestsCache="
+ mNetworkRequestsCache);
}
for (AwareNetworkRequestInformation nnri : mNetworkRequestsCache.values()) {
if (nnri == req) {
continue;
}
if (Arrays.equals(req.peerDiscoveryMac, nnri.peerDiscoveryMac)) {
used.add(nnri.interfaceName);
}
}
if (VDBG) {
Log.v(TAG, "selectInterfaceForRequest: potential=" + potential + ", used=" + used);
}
for (String ifName: potential) {
if (!used.contains(ifName)) {
return ifName;
}
}
Log.e(TAG, "selectInterfaceForRequest: req=" + req + " - no interfaces available!");
return null;
}
/**
* Select a channel for the network request.
*
* TODO (b/38209409): The value from this function isn't currently used - the channel selection
* is delegated to the HAL.
*/
private int selectChannelForRequest(AwareNetworkRequestInformation req) {
return 2437;
}
/**
* Aware network request. State object: contains network request information/state through its
* lifetime.
*/
@VisibleForTesting
public static class AwareNetworkRequestInformation {
static final int STATE_IDLE = 100;
static final int STATE_WAIT_FOR_CONFIRM = 101;
static final int STATE_CONFIRMED = 102;
static final int STATE_INITIATOR_WAIT_FOR_REQUEST_RESPONSE = 103;
static final int STATE_RESPONDER_WAIT_FOR_REQUEST = 104;
static final int STATE_RESPONDER_WAIT_FOR_RESPOND_RESPONSE = 105;
static final int STATE_TERMINATING = 106;
public int state;
public int uid;
public String interfaceName;
public int pubSubId = 0;
public int peerInstanceId = 0;
public byte[] peerDiscoveryMac = null;
public int ndpId = 0; // 0 is never a valid ID!
public byte[] peerDataMac;
public WifiAwareNetworkSpecifier networkSpecifier;
public List<NanDataPathChannelInfo> channelInfo;
public long startTimestamp = 0; // request is made (initiator) / get request (responder)
public WifiAwareNetworkAgent networkAgent;
/* A collection of specifiers which are equivalent to the current request and are
* supported by it's agent. This list DOES include the original (first) network specifier
* (which is stored separately above).
*/
public Set<WifiAwareNetworkSpecifier> equivalentSpecifiers = new HashSet<>();
void updateToSupportNewRequest(WifiAwareNetworkSpecifier ns) {
if (VDBG) Log.v(TAG, "updateToSupportNewRequest: ns=" + ns);
if (equivalentSpecifiers.add(ns) && state == STATE_CONFIRMED) {
if (networkAgent == null) {
Log.wtf(TAG, "updateToSupportNewRequest: null agent in CONFIRMED state!?");
return;
}
networkAgent.sendNetworkCapabilities(getNetworkCapabilities());
}
}
void removeSupportForRequest(WifiAwareNetworkSpecifier ns) {
if (VDBG) Log.v(TAG, "removeSupportForRequest: ns=" + ns);
equivalentSpecifiers.remove(ns);
// we will not update the agent:
// 1. this will only get called before the agent is created
// 2. connectivity service does not allow (WTF) updates with reduced capabilities
}
private NetworkCapabilities getNetworkCapabilities() {
NetworkCapabilities nc = new NetworkCapabilities(sNetworkCapabilitiesFilter);
nc.setNetworkSpecifier(new WifiAwareAgentNetworkSpecifier(equivalentSpecifiers.toArray(
new WifiAwareNetworkSpecifier[equivalentSpecifiers.size()])));
return nc;
}
/**
* Returns a canonical descriptor for the network request.
*/
CanonicalConnectionInfo getCanonicalDescriptor() {
return new CanonicalConnectionInfo(peerDiscoveryMac, networkSpecifier.pmk,
networkSpecifier.sessionId, networkSpecifier.passphrase);
}
static AwareNetworkRequestInformation processNetworkSpecifier(WifiAwareNetworkSpecifier ns,
WifiAwareStateManager mgr, WifiPermissionsUtil wifiPermissionsUtil,
WifiPermissionsWrapper permissionWrapper,
boolean allowNdpResponderFromAnyOverride) {
int uid, pubSubId = 0;
int peerInstanceId = 0;
byte[] peerMac = ns.peerMac;
if (VDBG) {
Log.v(TAG, "processNetworkSpecifier: networkSpecifier=" + ns);
}
// type: always valid
if (ns.type < 0
|| ns.type > WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_MAX_VALID) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns
+ ", invalid 'type' value");
return null;
}
// role: always valid
if (ns.role != WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_INITIATOR
&& ns.role != WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns
+ " -- invalid 'role' value");
return null;
}
if (ns.role == WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_INITIATOR
&& ns.type != WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_IB
&& ns.type != WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_OOB) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns
+ " -- invalid 'type' value for INITIATOR (only IB and OOB are "
+ "permitted)");
return null;
}
// look up network specifier information in Aware state manager
WifiAwareClientState client = mgr.getClient(ns.clientId);
if (client == null) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns
+ " -- not client with this id -- clientId=" + ns.clientId);
return null;
}
uid = client.getUid();
// API change post 27: no longer allow "ANY"-style responders (initiators were never
// permitted).
// Note: checks are done on the manager. This is a backup for apps which bypass the
// check.
if (!allowNdpResponderFromAnyOverride && !wifiPermissionsUtil.isLegacyVersion(
client.getCallingPackage(), Build.VERSION_CODES.P)) {
if (ns.type != WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_IB
&& ns.type != WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_OOB) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns
+ " -- no ANY specifications allowed for this API level");
return null;
}
}
// validate the role (if session ID provided: i.e. session 1xx)
if (ns.type == WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_IB
|| ns.type == WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_IB_ANY_PEER) {
WifiAwareDiscoverySessionState session = client.getSession(ns.sessionId);
if (session == null) {
Log.e(TAG,
"processNetworkSpecifier: networkSpecifier=" + ns
+ " -- no session with this id -- sessionId=" + ns.sessionId);
return null;
}
if ((session.isPublishSession()
&& ns.role != WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_RESPONDER) || (
!session.isPublishSession() && ns.role
!= WifiAwareManager.WIFI_AWARE_DATA_PATH_ROLE_INITIATOR)) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns
+ " -- invalid role for session type");
return null;
}
if (ns.type == WifiAwareNetworkSpecifier.NETWORK_SPECIFIER_TYPE_IB) {
pubSubId = session.getPubSubId();
WifiAwareDiscoverySessionState.PeerInfo peerInfo = session.getPeerInfo(
ns.peerId);
if (peerInfo == null) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns
+ " -- no peer info associated with this peer id -- peerId="
+ ns.peerId);
return null;
}
peerInstanceId = peerInfo.mInstanceId;
try {
peerMac = peerInfo.mMac;
if (peerMac == null || peerMac.length != 6) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier="
+ ns + " -- invalid peer MAC address");
return null;
}
} catch (IllegalArgumentException e) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns
+ " -- invalid peer MAC address -- e=" + e);
return null;
}
}
}
// validate UID
if (ns.requestorUid != uid) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns.toString()
+ " -- UID mismatch to clientId's uid=" + uid);
return null;
}
// validate permission if PMK is used (SystemApi)
if (ns.pmk != null && ns.pmk.length != 0) {
if (permissionWrapper.getUidPermission(Manifest.permission.CONNECTIVITY_INTERNAL,
ns.requestorUid) != PackageManager.PERMISSION_GRANTED) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns.toString()
+ " -- UID doesn't have permission to use PMK API");
return null;
}
}
// validate passphrase & PMK (if provided)
if (!TextUtils.isEmpty(ns.passphrase)) { // non-null indicates usage
if (!WifiAwareUtils.validatePassphrase(ns.passphrase)) {
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns.toString()
+ " -- invalid passphrase length: " + ns.passphrase.length());
return null;
}
}
if (ns.pmk != null && !WifiAwareUtils.validatePmk(ns.pmk)) { // non-null indicates usage
Log.e(TAG, "processNetworkSpecifier: networkSpecifier=" + ns.toString()
+ " -- invalid pmk length: " + ns.pmk.length);
return null;
}
// create container and populate
AwareNetworkRequestInformation nnri = new AwareNetworkRequestInformation();
nnri.state = AwareNetworkRequestInformation.STATE_IDLE;
nnri.uid = uid;
nnri.pubSubId = pubSubId;
nnri.peerInstanceId = peerInstanceId;
nnri.peerDiscoveryMac = peerMac;
nnri.networkSpecifier = ns;
nnri.equivalentSpecifiers.add(ns);
return nnri;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("AwareNetworkRequestInformation: ");
sb.append("state=").append(state).append(", ns=").append(networkSpecifier).append(
", uid=").append(uid).append(", interfaceName=").append(interfaceName).append(
", pubSubId=").append(pubSubId).append(", peerInstanceId=").append(
peerInstanceId).append(", peerDiscoveryMac=").append(
peerDiscoveryMac == null ? ""
: String.valueOf(HexEncoding.encode(peerDiscoveryMac))).append(
", ndpId=").append(ndpId).append(", peerDataMac=").append(
peerDataMac == null ? ""
: String.valueOf(HexEncoding.encode(peerDataMac))).append(
", startTimestamp=").append(startTimestamp).append(", channelInfo=").append(
channelInfo).append(", equivalentSpecifiers=[");
for (WifiAwareNetworkSpecifier ns: equivalentSpecifiers) {
sb.append(ns.toString()).append(", ");
}
return sb.append("]").toString();
}
}
/**
* A canonical (unique) descriptor of the peer connection.
*/
static class CanonicalConnectionInfo {
CanonicalConnectionInfo(byte[] peerDiscoveryMac, byte[] pmk, int sessionId,
String passphrase) {
this.peerDiscoveryMac = peerDiscoveryMac;
this.pmk = pmk;
this.sessionId = sessionId;
this.passphrase = passphrase;
}
public final byte[] peerDiscoveryMac;
/*
* Security configuration matching:
* - open: pmk/passphrase = null
* - pmk: pmk != null, passphrase = null
* - passphrase: passphrase != null, sessionId used (==0 for OOB), pmk=null
*/
public final byte[] pmk;
public final int sessionId;
public final String passphrase;
public boolean matches(CanonicalConnectionInfo other) {
return (other.peerDiscoveryMac == null || Arrays
.equals(peerDiscoveryMac, other.peerDiscoveryMac))
&& Arrays.equals(pmk, other.pmk)
&& TextUtils.equals(passphrase, other.passphrase)
&& (TextUtils.isEmpty(passphrase) || sessionId == other.sessionId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("CanonicalConnectionInfo: [");
sb.append("peerDiscoveryMac=").append(peerDiscoveryMac == null ? ""
: String.valueOf(HexEncoding.encode(peerDiscoveryMac))).append(", pmk=").append(
pmk == null ? "" : "*").append(", sessionId=").append(sessionId).append(
", passphrase=").append(passphrase == null ? "" : "*").append("]");
return sb.toString();
}
}
/**
* Enables mocking.
*/
@VisibleForTesting
public class NetworkInterfaceWrapper {
/**
* Configures network agent properties: link-local address, connected status, interface
* name. Delegated to enable mocking.
*/
public boolean configureAgentProperties(AwareNetworkRequestInformation nnri,
Set<WifiAwareNetworkSpecifier> networkSpecifiers, int ndpId,
NetworkInfo networkInfo, NetworkCapabilities networkCapabilities,
LinkProperties linkProperties) {
// find link-local address
InetAddress linkLocal = null;
NetworkInterface ni;
try {
ni = NetworkInterface.getByName(nnri.interfaceName);
} catch (SocketException e) {
Log.e(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri
+ ": can't get network interface - " + e);
mMgr.endDataPath(ndpId);
nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING;
return false;
}
if (ni == null) {
Log.e(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri
+ ": can't get network interface (null)");
mMgr.endDataPath(ndpId);
nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING;
return false;
}
Enumeration<InetAddress> addresses = ni.getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress ip = addresses.nextElement();
if (ip instanceof Inet6Address && ip.isLinkLocalAddress()) {
linkLocal = ip;
break;
}
}
if (linkLocal == null) {
Log.e(TAG, "onDataPathConfirm: ACCEPT nnri=" + nnri + ": no link local addresses");
mMgr.endDataPath(ndpId);
nnri.state = AwareNetworkRequestInformation.STATE_TERMINATING;
return false;
}
// configure agent
networkInfo.setIsAvailable(true);
networkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED, null, null);
networkCapabilities.setNetworkSpecifier(new WifiAwareAgentNetworkSpecifier(
networkSpecifiers.toArray(new WifiAwareNetworkSpecifier[0])));
linkProperties.setInterfaceName(nnri.interfaceName);
linkProperties.addLinkAddress(new LinkAddress(linkLocal, 64));
linkProperties.addRoute(
new RouteInfo(new IpPrefix("fe80::/64"), null, nnri.interfaceName));
return true;
}
}
/**
* Dump the internal state of the class.
*/
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("WifiAwareDataPathStateManager:");
pw.println(" mInterfaces: " + mInterfaces);
pw.println(" sNetworkCapabilitiesFilter: " + sNetworkCapabilitiesFilter);
pw.println(" mNetworkRequestsCache: " + mNetworkRequestsCache);
pw.println(" mNetworkFactory:");
mNetworkFactory.dump(fd, pw, args);
}
}
| 43.605457 | 100 | 0.59886 |
81c8cbeb19072835128a5d22fcd5212a2a23879e | 1,794 | html | HTML | learn-js/www/index copy 2.html | t4d-classes/adv-javascript-tooling-and-dev_11152021 | db6e6d9cc8f7e8b8c14747889677427806c812f1 | [
"MIT"
] | null | null | null | learn-js/www/index copy 2.html | t4d-classes/adv-javascript-tooling-and-dev_11152021 | db6e6d9cc8f7e8b8c14747889677427806c812f1 | [
"MIT"
] | null | null | null | learn-js/www/index copy 2.html | t4d-classes/adv-javascript-tooling-and-dev_11152021 | db6e6d9cc8f7e8b8c14747889677427806c812f1 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<script>
'use strict';
// const person = {
// fullName: function() {
// return this.firstName + ' ' + this.lastName;
// }
// };
// const bob = Object.create(person);
// bob.firstName = "Bob";
// bob.lastName = "Smith";
// console.log(bob.fullName());
// const timmy = Object.create(person);
// timmy.firstName = "Timmy";
// timmy.lastName = "Johnson";
// console.log(timmy.fullName());
// console.log(bob.fullName === timmy.fullName);
// class Person {
// constructor(firstName, lastName) {
// this.firstName = firstName;
// this.lastName = lastName;
// }
// fullName() {
// return this.firstName + ' ' + this.lastName;
// }
// }
// const sally = new Person('Sally', 'Thompson');
// console.log(sally.fullName());
// const susan = new Person('Susan', 'Allen');
// console.log(susan.fullName());
// console.log(sally.fullName === susan.fullName);
function Person2(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
Person2.prototype.fullName = function() {
return this.firstName + ' ' + this.lastName;
}
console.log(Person2.__proto__);
console.log(Person2.prototype);
const johnny = new Person2("Johnny", "Cash");
console.log(johnny.fullName())
Person2.prototype.recordInfo = function() {
return this.lastName + ", " + this.firstName;
};
console.log(johnny.recordInfo());
// console.dir(Person);
// console.dir(Person2);
</script>
</body>
</html>
| 22.425 | 57 | 0.535674 |
51f28e1ce9985f5c900ddf52f2009f58e1f4af11 | 1,982 | swift | Swift | Lecture04/UIWindow-Demo/UIWindow-Demo/ValidationWindow.swift | kingcos/CS193P_2017 | ea6215fb1b09c018d0a47ab2e4b8d3536c3d8af1 | [
"MIT"
] | 76 | 2017-02-19T10:36:17.000Z | 2020-01-04T19:56:38.000Z | Lecture04/UIWindow-Demo/UIWindow-Demo/ValidationWindow.swift | kingcos/CS193P_2017 | ea6215fb1b09c018d0a47ab2e4b8d3536c3d8af1 | [
"MIT"
] | null | null | null | Lecture04/UIWindow-Demo/UIWindow-Demo/ValidationWindow.swift | kingcos/CS193P_2017 | ea6215fb1b09c018d0a47ab2e4b8d3536c3d8af1 | [
"MIT"
] | 24 | 2017-03-05T07:43:32.000Z | 2019-08-21T08:40:16.000Z | //
// ValidationWindow.swift
// UIWindow-Demo
//
// Created by 买明 on 26/02/2017.
// Copyright © 2017 买明. All rights reserved.
//
import UIKit
class ValidationWindow: UIWindow {
var textField: UITextField?
static let sharedInstance = ValidationWindow(frame: UIScreen.main.bounds)
override init(frame: CGRect) {
super.init(frame: frame)
let label = UILabel(frame: CGRect(x: 10, y: 50, width: 200, height: 20))
label.text = "请输入密码"
addSubview(label)
let textField = UITextField(frame: CGRect(x: 10, y: 80, width: 200, height: 20))
textField.backgroundColor = UIColor.white
textField.isSecureTextEntry = true
self.textField = textField
addSubview(textField)
let button = UIButton(frame: CGRect(x: 10, y: 110, width: 200, height: 44))
button.backgroundColor = UIColor.blue
button.titleLabel?.textColor = UIColor.black
button.setTitle("确定", for: .normal)
button.addTarget(self, action: #selector(completeButtonPressed), for: .touchUpInside)
addSubview(button)
backgroundColor = UIColor.yellow
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func completeButtonPressed() {
let textContent = textField?.text
textField?.text?.removeAll()
if textContent == "abcd" {
textField?.resignFirstResponder()
resignKey()
isHidden = true
} else {
showErrorAlertView()
}
}
func showErrorAlertView() {
let alertView = UIAlertView(title: "密码错误",
message: "正确密码是 abcd",
delegate: self,
cancelButtonTitle: "Ok")
alertView.show()
}
func show() {
makeKey()
isHidden = false
}
}
| 28.724638 | 93 | 0.569627 |
d3e7b11df861413522afb297d9e5da390279903e | 6,989 | sql | SQL | apps/ent/affiliation/partnertype/partnertype.sql | agungdhewe/oss | 253fafeb3a894f71ad10884e9beae0763e5535b3 | [
"BSD-3-Clause"
] | null | null | null | apps/ent/affiliation/partnertype/partnertype.sql | agungdhewe/oss | 253fafeb3a894f71ad10884e9beae0763e5535b3 | [
"BSD-3-Clause"
] | 3 | 2021-11-23T00:37:53.000Z | 2021-11-23T04:32:51.000Z | apps/ent/affiliation/partnertype/partnertype.sql | agungdhewe/oss | 253fafeb3a894f71ad10884e9beae0763e5535b3 | [
"BSD-3-Clause"
] | null | null | null | -- SET FOREIGN_KEY_CHECKS=0;
-- drop table if exists `mst_partnertype`;
-- drop table if exists `mst_partnertypeaccbudget`;
CREATE TABLE `mst_partnertype` (
`partnertype_id` varchar(10) NOT NULL ,
`partnertype_name` varchar(60) NOT NULL ,
`partnertype_descr` varchar(90) NOT NULL ,
`partnercategory_id` varchar(10) ,
`itemclass_id` varchar(14) ,
`unbill_accbudget_id` varchar(20) ,
`unbill_coa_id` varchar(20) ,
`payable_accbudget_id` varchar(20) ,
`payable_coa_id` varchar(20) ,
`arunbill_accbudget_id` varchar(20) ,
`arunbill_coa_id` varchar(20) ,
`ar_accbudget_id` varchar(20) ,
`ar_coa_id` varchar(20) ,
`partnertype_isempl` tinyint(1) NOT NULL DEFAULT 0,
`partnertype_ishaveae` tinyint(1) NOT NULL DEFAULT 0,
`partnertype_ishavecollector` tinyint(1) NOT NULL DEFAULT 0,
`partnertype_isdisabled` tinyint(1) NOT NULL DEFAULT 0,
`_createby` varchar(13) NOT NULL ,
`_createdate` datetime NOT NULL DEFAULT current_timestamp(),
`_modifyby` varchar(13) ,
`_modifydate` datetime ,
UNIQUE KEY `partnertype_name` (`partnertype_name`),
PRIMARY KEY (`partnertype_id`)
)
ENGINE=InnoDB
COMMENT='Daftar Tipe Partner';
ALTER TABLE `mst_partnertype` ADD KEY `partnercategory_id` (`partnercategory_id`);
ALTER TABLE `mst_partnertype` ADD KEY `itemclass_id` (`itemclass_id`);
ALTER TABLE `mst_partnertype` ADD KEY `unbill_accbudget_id` (`unbill_accbudget_id`);
ALTER TABLE `mst_partnertype` ADD KEY `unbill_coa_id` (`unbill_coa_id`);
ALTER TABLE `mst_partnertype` ADD KEY `payable_accbudget_id` (`payable_accbudget_id`);
ALTER TABLE `mst_partnertype` ADD KEY `payable_coa_id` (`payable_coa_id`);
ALTER TABLE `mst_partnertype` ADD KEY `arunbill_accbudget_id` (`arunbill_accbudget_id`);
ALTER TABLE `mst_partnertype` ADD KEY `arunbill_coa_id` (`arunbill_coa_id`);
ALTER TABLE `mst_partnertype` ADD KEY `ar_accbudget_id` (`ar_accbudget_id`);
ALTER TABLE `mst_partnertype` ADD KEY `ar_coa_id` (`ar_coa_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_partnercategory` FOREIGN KEY (`partnercategory_id`) REFERENCES `mst_partnercategory` (`partnercategory_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_itemclass` FOREIGN KEY (`itemclass_id`) REFERENCES `mst_itemclass` (`itemclass_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_accbudget` FOREIGN KEY (`unbill_accbudget_id`) REFERENCES `mst_accbudget` (`accbudget_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_coa` FOREIGN KEY (`unbill_coa_id`) REFERENCES `mst_coa` (`coa_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_accbudget_2` FOREIGN KEY (`payable_accbudget_id`) REFERENCES `mst_accbudget` (`accbudget_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_coa_2` FOREIGN KEY (`payable_coa_id`) REFERENCES `mst_coa` (`coa_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_accbudget_3` FOREIGN KEY (`arunbill_accbudget_id`) REFERENCES `mst_accbudget` (`accbudget_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_coa_3` FOREIGN KEY (`arunbill_coa_id`) REFERENCES `mst_coa` (`coa_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_accbudget_4` FOREIGN KEY (`ar_accbudget_id`) REFERENCES `mst_accbudget` (`accbudget_id`);
ALTER TABLE `mst_partnertype` ADD CONSTRAINT `fk_mst_partnertype_mst_coa_4` FOREIGN KEY (`ar_coa_id`) REFERENCES `mst_coa` (`coa_id`);
CREATE TABLE `mst_partnertypeaccbudget` (
`partnertypeaccbudget_id` varchar(14) NOT NULL ,
`projectmodel_id` varchar(10) ,
`unbill_accbudget_id` varchar(20) ,
`unbill_coa_id` varchar(20) ,
`payable_accbudget_id` varchar(20) ,
`payable_coa_id` varchar(20) ,
`arunbill_accbudget_id` varchar(20) ,
`arunbill_coa_id` varchar(20) ,
`ar_accbudget_id` varchar(20) ,
`ar_coa_id` varchar(20) ,
`partnertype_id` varchar(14) NOT NULL ,
`_createby` varchar(13) NOT NULL ,
`_createdate` datetime NOT NULL DEFAULT current_timestamp(),
`_modifyby` varchar(13) ,
`_modifydate` datetime ,
UNIQUE KEY `partnertypeaccbudget_pair` (`partnertype_id`, `projectmodel_id`),
PRIMARY KEY (`partnertypeaccbudget_id`)
)
ENGINE=InnoDB
COMMENT='Account yang direlasikan ke itemclass ini';
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `projectmodel_id` (`projectmodel_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `unbill_accbudget_id` (`unbill_accbudget_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `unbill_coa_id` (`unbill_coa_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `payable_accbudget_id` (`payable_accbudget_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `payable_coa_id` (`payable_coa_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `arunbill_accbudget_id` (`arunbill_accbudget_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `arunbill_coa_id` (`arunbill_coa_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `ar_accbudget_id` (`ar_accbudget_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `ar_coa_id` (`ar_coa_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD KEY `partnertype_id` (`partnertype_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_projectmodel` FOREIGN KEY (`projectmodel_id`) REFERENCES `mst_projectmodel` (`projectmodel_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_accbudget` FOREIGN KEY (`unbill_accbudget_id`) REFERENCES `mst_accbudget` (`accbudget_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_coa` FOREIGN KEY (`unbill_coa_id`) REFERENCES `mst_coa` (`coa_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_accbudget_2` FOREIGN KEY (`payable_accbudget_id`) REFERENCES `mst_accbudget` (`accbudget_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_coa_2` FOREIGN KEY (`payable_coa_id`) REFERENCES `mst_coa` (`coa_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_accbudget_3` FOREIGN KEY (`arunbill_accbudget_id`) REFERENCES `mst_accbudget` (`accbudget_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_coa_3` FOREIGN KEY (`arunbill_coa_id`) REFERENCES `mst_coa` (`coa_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_accbudget_4` FOREIGN KEY (`ar_accbudget_id`) REFERENCES `mst_accbudget` (`accbudget_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_coa_4` FOREIGN KEY (`ar_coa_id`) REFERENCES `mst_coa` (`coa_id`);
ALTER TABLE `mst_partnertypeaccbudget` ADD CONSTRAINT `fk_mst_partnertypeaccbudget_mst_partnertype` FOREIGN KEY (`partnertype_id`) REFERENCES `mst_partnertype` (`partnertype_id`);
| 64.119266 | 184 | 0.783946 |
80f5fed589c384637048d8bd8a641dc42134d149 | 9,702 | swift | Swift | sofastcar/sofastcar/View/Reservation/ReturnVehicleStatusView.swift | SoFastCar/SoFastCar-IOS | bafe1e9bd1f0f077d672e433f017b1af51f48999 | [
"MIT"
] | 1 | 2020-08-14T01:07:04.000Z | 2020-08-14T01:07:04.000Z | sofastcar/sofastcar/View/Reservation/ReturnVehicleStatusView.swift | SoFastCar/SoFastCar-IOS | bafe1e9bd1f0f077d672e433f017b1af51f48999 | [
"MIT"
] | 102 | 2020-09-01T05:50:09.000Z | 2020-10-08T01:40:37.000Z | sofastcar/sofastcar/View/Reservation/ReturnVehicleStatusView.swift | SoFastCar/SoFastCar-IOS | bafe1e9bd1f0f077d672e433f017b1af51f48999 | [
"MIT"
] | 11 | 2020-08-13T12:52:18.000Z | 2021-08-17T00:01:23.000Z | //
// ReturnVehicleStatusView.swift
// sofastcar
//
// Created by 요한 on 2020/09/21.
// Copyright © 2020 김광수. All rights reserved.
//
import UIKit
protocol ReturnVehicleStatusViewDelegate: class {
func buttonAction(_ sender: UIButton)
}
class ReturnVehicleStatusView: UIView {
weak var customDelegate: ReturnVehicleStatusViewDelegate?
fileprivate let warningImage: UIImageView = {
let imageView = UIImageView()
let config = UIImage.SymbolConfiguration(pointSize: 30, weight: .light, scale: .large)
imageView.image = UIImage(
systemName: CommonUI.SFSymbolKey.warning.rawValue,
withConfiguration: config
)
imageView.tintColor = CommonUI.mainDark
return imageView
}()
fileprivate let descriptionLabel: UILabel = {
let label = UILabel()
label.text = "반납을 위해 아래 항목을 확인해주세요"
label.textColor = CommonUI.mainDark
label.font = UIFont.preferredFont(forTextStyle: .headline)
return label
}()
fileprivate let startingStatusLabel: UILabel = {
let label = UILabel()
label.text = "시동"
label.textColor = CommonUI.mainDark
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate let headlightStatusLabel: UILabel = {
let label = UILabel()
label.text = "전조등"
label.textColor = CommonUI.mainDark
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate let lockStatusLabel: UILabel = {
let label = UILabel()
label.text = "잠금 상태"
label.textColor = CommonUI.mainDark
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate let doorCloseStatusLabel: UILabel = {
let label = UILabel()
label.text = "차량 문"
label.textColor = CommonUI.mainDark
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate let returnTimeStatusLabel: UILabel = {
let label = UILabel()
label.text = "반납 시간"
label.textColor = CommonUI.mainDark
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate lazy var vehicleStatusLabelStackView: UIStackView = {
let stackView = UIStackView(
arrangedSubviews: [
startingStatusLabel,
headlightStatusLabel,
lockStatusLabel,
doorCloseStatusLabel,
returnTimeStatusLabel
]
)
stackView.axis = .vertical
stackView.spacing = 20
return stackView
}()
fileprivate let startingIndicatorImage: UIImageView = {
let imageView = UIImageView()
let config = UIImage.SymbolConfiguration(pointSize: 15, weight: .light, scale: .small)
imageView.image = UIImage(
systemName: CommonUI.SFSymbolKey.circle.rawValue,
withConfiguration: config
)
imageView.tintColor = CommonUI.mainDark.withAlphaComponent(0.3)
return imageView
}()
fileprivate let headlightIndicatorImage: UIImageView = {
let imageView = UIImageView()
let config = UIImage.SymbolConfiguration(pointSize: 15, weight: .light, scale: .small)
imageView.image = UIImage(
systemName: CommonUI.SFSymbolKey.circle.rawValue,
withConfiguration: config
)
imageView.tintColor = CommonUI.mainDark.withAlphaComponent(0.3)
return imageView
}()
fileprivate let lockIndicatorImage: UIImageView = {
let imageView = UIImageView()
let config = UIImage.SymbolConfiguration(pointSize: 15, weight: .light, scale: .small)
imageView.image = UIImage(
systemName: CommonUI.SFSymbolKey.circle.rawValue,
withConfiguration: config
)
imageView.tintColor = .red
return imageView
}()
fileprivate let doorCloseIndicatorImage: UIImageView = {
let imageView = UIImageView()
let config = UIImage.SymbolConfiguration(pointSize: 15, weight: .light, scale: .small)
imageView.image = UIImage(
systemName: CommonUI.SFSymbolKey.circle.rawValue,
withConfiguration: config
)
imageView.tintColor = CommonUI.mainDark.withAlphaComponent(0.3)
return imageView
}()
fileprivate let returnTimeIndicatorImage: UIImageView = {
let imageView = UIImageView()
let config = UIImage.SymbolConfiguration(pointSize: 15, weight: .light, scale: .small)
imageView.image = UIImage(
systemName: CommonUI.SFSymbolKey.circle.rawValue,
withConfiguration: config
)
imageView.tintColor = CommonUI.mainDark.withAlphaComponent(0.3)
return imageView
}()
fileprivate lazy var vehicleReturnOptionIndicatorStackView: UIStackView = {
let stackView = UIStackView(
arrangedSubviews: [
startingIndicatorImage,
headlightIndicatorImage,
lockIndicatorImage,
doorCloseIndicatorImage,
returnTimeIndicatorImage
]
)
stackView.axis = .vertical
stackView.spacing = 20
return stackView
}()
fileprivate let startingStatusToggleLabel: UILabel = {
let label = UILabel()
label.text = "OFF 완료"
label.textColor = CommonUI.mainDark.withAlphaComponent(0.3)
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate let headlightStatusToggleLabel: UILabel = {
let label = UILabel()
label.text = "OFF 완료"
label.textColor = CommonUI.mainDark.withAlphaComponent(0.3)
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate let lockStatusToggleLabel: UILabel = {
let label = UILabel()
label.text = "잠금 필요"
label.textColor = CommonUI.mainDark
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate let doorCloseStatusToggleLabel: UILabel = {
let label = UILabel()
label.text = "OFF 완료"
label.textColor = CommonUI.mainDark.withAlphaComponent(0.3)
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate let returnTimeStatusToggleLabel: UILabel = {
let label = UILabel()
label.text = "OFF 완료"
label.textColor = CommonUI.mainDark.withAlphaComponent(0.3)
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
return label
}()
fileprivate lazy var vehicleReturnOptionLabelStackView: UIStackView = {
let stackView = UIStackView(
arrangedSubviews: [
startingStatusToggleLabel,
headlightStatusToggleLabel,
lockStatusToggleLabel,
doorCloseStatusToggleLabel,
returnTimeStatusToggleLabel
]
)
stackView.axis = .vertical
stackView.spacing = 20
return stackView
}()
let anyProblemButton: UIButton = {
let button = UIButton()
button.setTitle("혹시 문제가 생겼나요?", for: .normal)
button.setTitleColor(CommonUI.mainDark, for: .normal)
if let title = button.titleLabel?.text {
button.setAttributedTitle(title.getUnderLineAttributedText(), for: .normal)
}
button.titleLabel?.font = UIFont.preferredFont(forTextStyle: .subheadline)
button.addTarget(self, action: #selector(buttonAction(_:)), for: .touchUpInside)
return button
}()
let checkButton: UIButton = {
let button = UIButton()
button.setTitle("확인", for: .normal)
button.setTitleColor(CommonUI.mainDark, for: .normal)
button.backgroundColor = .clear
button.layer.borderWidth = 1
button.layer.borderColor = UIColor.black.withAlphaComponent(0.3).cgColor
button.addTarget(self, action: #selector(buttonAction(_:)), for: .touchUpInside)
return button
}()
// MARK: - LifeCycle
override init(frame: CGRect) {
super.init(frame: frame)
setUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - UI
fileprivate func setUI() {
self.backgroundColor = .white
[
warningImage,
descriptionLabel,
vehicleStatusLabelStackView,
vehicleReturnOptionIndicatorStackView,
vehicleReturnOptionLabelStackView,
anyProblemButton,
checkButton
].forEach {
self.addSubview($0)
}
setConstraints()
}
fileprivate func setConstraints() {
warningImage.snp.makeConstraints {
$0.top.equalToSuperview().offset(30)
$0.leading.equalToSuperview().offset(20)
}
descriptionLabel.snp.makeConstraints {
$0.top.equalTo(warningImage.snp.bottom).offset(30)
$0.leading.equalToSuperview().offset(20)
}
vehicleStatusLabelStackView.snp.makeConstraints {
$0.top.equalTo(descriptionLabel.snp.bottom).offset(30)
$0.leading.equalToSuperview().offset(20)
}
vehicleReturnOptionIndicatorStackView.snp.makeConstraints {
$0.top.equalTo(descriptionLabel.snp.bottom).offset(30)
$0.leading.equalTo(vehicleStatusLabelStackView.snp.trailing).offset(30)
}
vehicleReturnOptionLabelStackView.snp.makeConstraints {
$0.top.equalTo(descriptionLabel.snp.bottom).offset(30)
$0.leading.equalTo(vehicleReturnOptionIndicatorStackView.snp.trailing).offset(10)
}
anyProblemButton.snp.makeConstraints {
$0.top.equalTo(vehicleReturnOptionLabelStackView.snp.bottom).offset(20)
$0.trailing.equalToSuperview().offset(-20)
}
checkButton.snp.makeConstraints {
$0.top.equalTo(anyProblemButton.snp.bottom).offset(20)
$0.leading.equalToSuperview().offset(20)
$0.trailing.equalToSuperview().offset(-20)
$0.height.equalTo(60)
}
}
// MARK: - Action
@objc func buttonAction(_ sender: UIButton) {
customDelegate?.buttonAction(sender)
}
}
| 28.535294 | 90 | 0.686766 |
3e4b1ba1f875d5fca73aa292e2f768f94d648d5e | 18,750 | sql | SQL | app/core/database/sql/transactionsSeeder.sql | adaviladev/cosc3380 | e47de9e760748b99de6870b81e07df0686044c4a | [
"MIT"
] | null | null | null | app/core/database/sql/transactionsSeeder.sql | adaviladev/cosc3380 | e47de9e760748b99de6870b81e07df0686044c4a | [
"MIT"
] | null | null | null | app/core/database/sql/transactionsSeeder.sql | adaviladev/cosc3380 | e47de9e760748b99de6870b81e07df0686044c4a | [
"MIT"
] | null | null | null | insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (1, 3, 9, 2, 1, 84.94, '2016-04-26 17:03:21', '2016-10-29 21:32:56');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (2, 54, 5, 4, 2, 74.41, '2016-02-23 20:29:49', '2017-02-23 13:39:45');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (3, 3, 7, 2, 3, 84.6, '2016-02-09 21:40:31', '2016-10-02 11:11:05');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (4, 3, 7, 5, 4, 17.23, '2016-02-16 02:51:35', '2016-05-29 03:38:27');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (5, 43, 8, 1, 5, 95.72, '2016-03-26 04:58:50', '2016-12-26 23:56:20');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (6, 44, 7, 5, 6, 75.1, '2016-03-17 08:40:59', '2016-08-12 04:58:16');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (7, 84, 6, 5, 7, 50.04, '2016-03-17 01:23:33', '2016-11-29 03:14:10');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (8, 30, 7, 2, 8, 34.6, '2016-04-21 03:36:11', '2017-02-19 12:11:05');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (9, 15, 2, 2, 9, 6.72, '2016-03-23 01:19:35', '2016-12-02 01:28:23');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (10, 3, 2, 4, 10, 89.68, '2016-02-18 03:11:01', '2016-11-29 17:24:54');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (11, 46, 4, 1, 11, 96.6, '2016-04-11 13:43:28', '2016-07-28 10:03:48');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (12, 3, 3, 3, 12, 49.4, '2016-04-19 04:24:51', '2016-10-23 00:37:47');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (13, 68, 9, 5, 13, 39.02, '2016-03-09 06:56:55', '2016-09-30 08:14:54');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (14, 95, 4, 5, 14, 24.6, '2016-03-21 19:06:58', '2016-05-14 19:48:19');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (15, 16, 5, 5, 15, 29.82, '2016-04-16 00:11:40', '2017-01-23 18:00:37');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (16, 18, 6, 5, 16, 39.14, '2016-04-04 17:38:48', '2016-08-17 03:29:19');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (17, 18, 8, 2, 17, 95.42, '2016-01-21 13:11:56', '2016-12-30 07:00:18');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (18, 18, 7, 4, 18, 13.58, '2016-03-12 18:41:25', '2016-05-18 19:30:51');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (19, 29, 4, 4, 19, 95.56, '2016-03-07 17:24:57', '2016-07-26 20:47:08');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (20, 38, 7, 5, 20, 68.82, '2016-01-03 07:58:07', '2016-08-07 10:58:40');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (21, 3, 6, 5, 21, 58.31, '2016-01-08 02:23:45', '2016-06-17 11:26:49');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (22, 29, 2, 5, 22, 39.37, '2016-02-14 03:30:18', '2017-01-14 04:30:54');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (23, 43, 9, 5, 23, 75.17, '2016-02-24 22:20:02', '2016-10-13 15:42:30');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (24, 43, 10, 3, 24, 37.22, '2016-01-24 19:51:48', '2016-11-29 20:16:26');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (25, 40, 1, 4, 25, 87.52, '2016-01-24 12:44:16', '2016-10-20 22:05:54');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (26, 78, 4, 2, 26, 90.7, '2016-02-11 08:01:51', '2016-10-23 15:49:53');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (27, 98, 7, 2, 27, 12.49, '2016-01-17 08:01:25', '2016-11-12 12:36:50');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (28, 74, 10, 3, 28, 22.5, '2016-01-02 00:17:32', '2017-01-05 01:57:15');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (29, 3, 4, 1, 29, 65.01, '2016-03-24 10:20:59', '2016-08-21 06:16:22');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (30, 61, 8, 5, 30, 66.16, '2016-04-12 11:29:13', '2016-07-27 22:34:59');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (31, 57, 10, 3, 31, 66.86, '2016-04-23 07:04:49', '2016-05-28 17:10:37');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (32, 62, 5, 2, 32, 19.63, '2016-03-11 16:57:36', '2016-08-22 06:34:03');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (33, 80, 9, 5, 33, 63.89, '2016-03-25 02:53:38', '2016-07-25 11:44:39');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (34, 63, 1, 1, 34, 89.05, '2016-03-27 11:58:17', '2017-02-04 01:51:21');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (35, 40, 7, 2, 35, 89.91, '2016-03-25 12:32:24', '2017-01-10 17:03:35');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (36, 3, 8, 4, 36, 76.81, '2016-02-08 18:22:47', '2016-08-25 16:37:26');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (37, 57, 7, 1, 37, 44.43, '2016-03-09 12:15:45', '2017-02-03 05:09:45');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (38, 48, 3, 9, 38, 90.97, '2016-01-29 01:23:07', '2016-08-19 17:05:34');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (39, 87, 7, 2, 39, 64.41, '2016-02-08 19:51:47', '2016-05-29 22:13:33');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (40, 3, 3, 3, 40, 43.9, '2016-04-01 06:56:48', '2017-02-11 12:56:37');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (41, 82, 2, 3, 41, 44.96, '2016-01-13 03:06:13', '2016-05-09 01:40:54');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (42, 62, 6, 1, 42, 39.76, '2016-01-13 23:14:48', '2016-08-25 11:14:01');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (43, 3, 9, 4, 43, 67.63, '2016-02-25 18:53:16', '2016-09-25 02:42:21');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (44, 72, 8, 3, 44, 64.07, '2016-01-19 11:35:20', '2017-02-19 12:47:24');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (45, 45, 10, 2, 45, 74.57, '2016-03-08 23:17:15', '2016-05-24 12:08:21');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (46, 80, 7, 3, 46, 80.0, '2016-01-06 11:59:51', '2016-05-09 19:03:33');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (47, 95, 9, 5, 47, 67.26, '2016-02-02 02:50:35', '2016-12-31 18:09:40');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (48, 95, 3, 5, 48, 39.85, '2016-03-15 08:37:54', '2016-05-15 05:20:54');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (49, 72, 5, 5, 49, 69.51, '2016-03-16 15:34:20', '2016-05-14 02:16:03');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (50, 72, 6, 4, 50, 12.16, '2016-04-05 01:29:37', '2016-11-18 20:16:44');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (51, 16, 4, 3, 51, 52.12, '2016-04-09 02:51:08', '2016-07-08 21:07:21');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (52, 3, 1, 2, 52, 25.88, '2016-03-23 00:37:23', '2016-12-23 04:33:41');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (53, 98, 10, 1, 53, 74.57, '2016-01-20 20:06:06', '2017-01-16 02:42:03');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (54, 50, 8, 1, 54, 7.18, '2016-04-28 03:09:38', '2016-08-23 17:35:00');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (55, 71, 6, 4, 55, 6.92, '2016-04-20 04:39:38', '2016-07-31 11:10:58');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (56, 40, 3, 5, 56, 12.91, '2016-03-16 04:41:04', '2016-05-27 08:04:28');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (57, 87, 9, 3, 57, 2.29, '2016-04-29 09:00:17', '2017-01-01 23:26:24');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (58, 63, 5, 4, 58, 95.48, '2016-02-23 02:15:19', '2016-10-02 00:42:40');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (59, 32, 9, 4, 59, 15.88, '2016-01-06 08:28:42', '2016-08-19 14:57:55');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (60, 40, 5, 2, 60, 43.81, '2016-01-29 00:30:52', '2017-01-10 14:31:48');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (61, 3, 10, 2, 61, 48.03, '2016-01-19 20:01:47', '2016-06-08 09:45:23');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (62, 82, 4, 1, 62, 82.17, '2016-02-21 22:00:28', '2016-12-12 12:48:27');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (63, 25, 3, 5, 63, 29.78, '2016-03-15 05:13:22', '2017-01-21 19:06:09');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (64, 25, 6, 3, 64, 31.98, '2016-04-10 04:22:34', '2016-09-25 02:55:26');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (65, 63, 7, 2, 65, 48.27, '2016-01-22 03:45:37', '2016-11-07 00:53:51');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (66, 21, 8, 5, 66, 17.93, '2016-02-12 15:29:20', '2016-06-05 10:58:16');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (67, 34, 1, 3, 67, 21.04, '2016-02-27 17:50:40', '2016-10-12 01:09:25');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (68, 30, 10, 3, 68, 3.62, '2016-01-10 02:21:39', '2016-06-13 06:59:36');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (69, 15, 10, 3, 69, 2.56, '2016-02-22 10:28:29', '2016-05-30 02:28:39');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (70, 38, 5, 2, 70, 73.25, '2016-01-18 11:16:25', '2016-07-06 17:15:49');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (71, 48, 4, 4, 71, 1.31, '2016-02-23 09:26:05', '2017-01-17 07:29:26');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (72, 3, 6, 4, 72, 8.72, '2016-01-20 18:24:33', '2017-02-17 18:27:09');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (73, 99, 9, 2, 73, 23.42, '2016-03-17 07:22:24', '2017-01-22 14:16:33');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (74, 29, 3, 4, 74, 19.9, '2016-02-07 11:24:47', '2016-12-09 18:56:53');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (75, 43, 6, 3, 75, 46.08, '2016-01-14 03:49:23', '2016-08-08 12:10:48');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (76, 3, 5, 2, 76, 31.66, '2016-04-08 01:58:07', '2016-12-10 16:06:23');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (77, 95, 7, 5, 77, 6.22, '2016-01-16 14:51:12', '2016-12-20 01:30:16');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (78, 21, 6, 3, 78, 47.19, '2016-03-22 00:48:58', '2017-01-24 08:58:22');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (79, 63, 3, 4, 79, 70.65, '2016-03-27 01:32:48', '2016-08-08 12:09:52');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (80, 77, 10, 4, 80, 68.06, '2016-02-21 04:00:34', '2016-10-23 05:24:45');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (81, 73, 1, 2, 81, 11.99, '2016-01-11 06:46:12', '2016-09-08 23:10:02');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (82, 3, 4, 3, 82, 76.78, '2016-03-13 09:01:10', '2016-05-23 02:55:48');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (83, 7, 9, 5, 83, 67.33, '2016-01-10 06:21:20', '2016-06-18 10:54:02');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (84, 74, 3, 3, 84, 42.2, '2016-03-29 00:09:30', '2016-09-24 17:47:10');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (85, 95, 10, 4, 85, 27.79, '2016-02-04 15:31:55', '2016-12-22 13:10:01');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (86, 3, 4, 2, 86, 21.04, '2016-01-21 16:15:57', '2016-08-09 04:57:05');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (87, 18, 8, 3, 87, 94.06, '2016-03-24 10:38:13', '2017-01-23 15:44:08');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (88, 72, 6, 5, 88, 53.32, '2016-03-01 08:34:07', '2016-05-28 08:31:48');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (89, 56, 2, 3, 89, 4.74, '2016-03-26 22:07:15', '2016-11-02 19:10:06');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (90, 69, 6, 4, 90, 84.68, '2016-01-29 21:24:46', '2016-08-19 06:40:34');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (91, 16, 4, 2, 91, 67.4, '2016-02-25 09:11:18', '2016-05-05 16:38:31');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (92, 30, 2, 3, 92, 44.65, '2016-04-15 10:44:33', '2016-05-26 03:20:25');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (93, 54, 2, 2, 93, 45.37, '2016-01-10 12:51:56', '2016-07-13 14:27:21');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (94, 62, 10, 2, 94, 89.19, '2016-01-27 15:52:10', '2017-01-28 13:52:27');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (95, 16, 6, 4, 95, 47.07, '2016-02-17 00:34:31', '2016-05-12 07:56:50');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (96, 48, 2, 4, 96, 33.13, '2016-04-05 09:57:27', '2016-10-19 01:53:23');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (97, 38, 6, 5, 97, 25.41, '2016-01-06 06:30:03', '2016-12-07 15:37:28');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (98, 3, 5, 4, 98, 41.9, '2016-03-13 09:29:55', '2016-05-12 01:30:57');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (99, 3, 5, 3, 99, 83.97, '2016-01-30 02:08:17', '2016-11-26 04:53:03');
insert into transactions (id, customerId, postOfficeId, employeeId, packageId, cost, createdAt, modifiedAt) values (100, 6, 3, 5, 100, 81.07, '2016-04-12 17:47:57', '2016-11-12 10:19:22'); | 187.5 | 188 | 0.712053 |
2d12a15bdff4826c965e6fe60b6b183dd783655c | 34,208 | asm | Assembly | lib/am335x_sdk/ti/drv/spi/firmware/icss_espi/src/pru_y/eSPI_cmd.asm | brandonbraun653/Apollo | a1ece2cc3f1d3dae48fdf8fe94f0bbb59d405fce | [
"MIT"
] | 2 | 2021-12-27T10:19:01.000Z | 2022-03-15T07:09:06.000Z | lib/am335x_sdk/ti/drv/spi/firmware/icss_espi/src/pru_y/eSPI_cmd.asm | brandonbraun653/Apollo | a1ece2cc3f1d3dae48fdf8fe94f0bbb59d405fce | [
"MIT"
] | null | null | null | lib/am335x_sdk/ti/drv/spi/firmware/icss_espi/src/pru_y/eSPI_cmd.asm | brandonbraun653/Apollo | a1ece2cc3f1d3dae48fdf8fe94f0bbb59d405fce | [
"MIT"
] | null | null | null | ;
; TEXAS INSTRUMENTS TEXT FILE LICENSE
;
; Copyright (c) 2018 Texas Instruments Incorporated
;
; All rights reserved not granted herein.
;
; Limited License.
;
; Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
; license under copyrights and patents it now or hereafter owns or controls to
; make, have made, use, import, offer to sell and sell ("Utilize") this software
; subject to the terms herein. With respect to the foregoing patent license,
; such license is granted solely to the extent that any such patent is necessary
; to Utilize the software alone. The patent license shall not apply to any
; combinations which include this software, other than combinations with devices
; manufactured by or for TI (“TI Devices”). No hardware patent is licensed hereunder.
;
; Redistributions must preserve existing copyright notices and reproduce this license
; (including the above copyright notice and the disclaimer and (if applicable) source
; code license limitations below) in the documentation and/or other materials provided
; with the distribution.
;
; Redistribution and use in binary form, without modification, are permitted provided
; that the following conditions are met:
; No reverse engineering, decompilation, or disassembly of this software is
; permitted with respect to any software provided in binary form.
; Any redistribution and use are licensed by TI for use only with TI Devices.
; Nothing shall obligate TI to provide you with source code for the software
; licensed and provided to you in object code.
;
; If software source code is provided to you, modification and redistribution of the
; source code are permitted provided that the following conditions are met:
; Any redistribution and use of the source code, including any resulting derivative
; works, are licensed by TI for use only with TI Devices.
; Any redistribution and use of any object code compiled from the source code
; and any resulting derivative works, are licensed by TI for use only with TI Devices.
;
; Neither the name of Texas Instruments Incorporated nor the names of its suppliers
; may be used to endorse or promote products derived from this software without
; specific prior written permission.
;
; DISCLAIMER.
;
; THIS SOFTWARE IS PROVIDED BY TI AND TI’S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED
; WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TI AND TI’S
; LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
; file: eSPI_cmd.asm
;
; brief: This files contains the CMD subroutines
;
;
; (C) Copyright 2018, Texas Instruments, Inc
;
;
;;; INCLUDES ;;;
.include "crc.h"
.include "eSPI_cmd.h"
.include "eSPI_control.h"
.include "icss_intc_regs.h"
.include "eSPI_pru_y_defines.h"
.include "eSPI_slave_registers.h"
;;; GLOBAL REFS ;;;
.global READY_STATE
.global FATAL_ERROR
.global SEND_NON_FATAL_ERROR
.global HANDLE_FLAG
;;; GLOBAL DEFINES ;;;
.text
;-------------------------------------------------------------------
; Subroutine: PUT_PC
; Description:
;-------------------------------------------------------------------
PUT_PC:
JMP NOT_IMPLEMENTED
;-------------------------------------------------------------------
; Subroutine: PUT_NP
; Description:
;-------------------------------------------------------------------
PUT_NP:
JMP NOT_IMPLEMENTED
;-------------------------------------------------------------------
; Subroutine: GET_PC
; Description:
;-------------------------------------------------------------------
GET_PC:
;; Define local register names
.asg r_Work0, _PacketInfo
.asg r_Work1, _Crc
.asg r_Work3, _TxPacketPtr
.asg r_Work4, _TxPacketEndAddr
.asg r_Work5, _TxBufferBase
.asg r_Work6, _Tmp0
.asg r_Work7, _InternalStatusReg
;;; CMD PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Set up CRC with CMD value
INIT_CRC r_CrcCalc, 0x1
;; Read Status Register
LBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
;; Read Internal Status Register
LBBO &_InternalStatusReg, r_SharedMemoryBase, INTERNAL_STATUS_REGISTER_BASE, 4
;; Finish reading packet
;; SET_PRU_X_STATE g_TarStateIdx ; PRU-BB is already reading last byte, prep TAR state
SET_PRU_BB_STATE g_TarState, r_Mode
READ_BYTE _Crc.b0 ; CRC
;;; TAR+WAIT PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; (>=40 CCs)
;; Ensure CRC is good to go
CHECK_CRC r_CrcCalc, _Crc.b0
;; Prep write
;; SET_PRU_X_STATE g_WriteStateIdx
SET_PRU_BB_STATE g_WriteState, r_Mode
;; If the status register indicates the TXQ is empty
;; respond with FATAL_ERROR
QBBC SEND_FATAL_ERROR, r_StatusReg, STATUS_PC_AVAIL_BIT
;; Prep TX Buffer
LDI _TxBufferBase, CH0_PC_TX_BUFFER_BASE
ADD _TxPacketPtr, r_SharedMemoryBase, _TxBufferBase
;; Read packet from TX Buffer
;; | byte3 | byte2 | byte1 | byte0 |
;; |-----------+-----------+-----------+-----------|
;; | packet b0 | LENGTH | MAGIC |
;; |-----------+-----------+-----------+-----------|
LBBO &_PacketInfo, _TxPacketPtr, 0, 4
ADD _TxPacketPtr, _TxPacketPtr, 3
;; Check Magic Number
QBNE SEND_NON_FATAL_ERROR, _PacketInfo.b0, ESPI_PACKET_MAGIC_NUMBER
;; Update TXQ_FULL_BIT bit in the Internal Status Register
CLR _InternalStatusReg, _InternalStatusReg, CHAN0_PC_TXQ_FULL_BIT
SBBO &_InternalStatusReg, r_SharedMemoryBase, INTERNAL_STATUS_REGISTER_BASE, 4
;; Update PC_AVAIL bit in Status Register
CLR r_StatusReg, r_StatusReg, STATUS_PC_AVAIL_BIT
SBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
XOUT BANK0, &r_StatusReg, 4
;; Setup Packet pointers. Can't use direct offsets, address is too large.
ADD _TxPacketEndAddr, r_SharedMemoryBase, _TxBufferBase
ADD _TxPacketEndAddr, _TxPacketEndAddr, _PacketInfo.w1
ADD _TxPacketEndAddr, _TxPacketEndAddr, 3 ; packet starts after MAGIC + LENGTH
;; Clear CRC value
CLEAR_CRC r_CrcCalc
;;; RSP PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Prepare and write ACCEPT response
LDI _Tmp0.b0, g_AcceptResponseCode
WRITE_BYTE_CRC _Tmp0.b0, r_CrcCalc
;; Write packet
get_pc_write_loop:
LBBO &_Tmp0.b0, _TxPacketPtr, 0, 1
WRITE_BYTE_CRC _Tmp0.b0, r_CrcCalc
ADD _TxPacketPtr, _TxPacketPtr, 1
QBLT get_pc_write_loop, _TxPacketEndAddr, _TxPacketPtr
;; Write status register
WRITE_BYTE_CRC r_StatusReg.b1, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b0, r_CrcCalc
;; PRU-BB about to write last byte, prep End state
;; SET_PRU_X_STATE g_EndStateIdx
;; SET_PRU_BB_STATE g_EndState, r_Zero
;; Write CRC byte
WRITE_CRC r_CrcCalc
SET_PRU_BB_STATE g_EndState, r_Zero
;; Fin
JMP END_STATE
;; Destroy local register names
.unasg _PacketInfo
.unasg _Crc
.unasg _TxPacketPtr
.unasg _TxPacketEndAddr
.unasg _TxBufferBase
.unasg _Tmp0
.unasg _InternalStatusReg
;-------------------------------------------------------------------
; Subroutine: GET_NP
; Description:
;-------------------------------------------------------------------
GET_NP:
JMP NOT_IMPLEMENTED
;-------------------------------------------------------------------
; Subroutine: PUT_IORD_SHORT
; Description: Pass packet directly to Host via the NP RXQ
;-------------------------------------------------------------------
PUT_IORD_SHORT_1:
PUT_IORD_SHORT_2:
PUT_IORD_SHORT_4:
;; Define local register names
.asg r_Work0, _PacketInfo ; magic number + length + CMD (write when length known)
.asg r_Work1, _PacketWord ; actual packet
.asg r_Work3, _InternalStatusReg
.asg r_Work4, _Tmp0
.asg r_Work5, _Crc
;;; CMD PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin to build packet with CMD opcode value
MOV _PacketInfo.b3, r_PruXData
;; Set up CRC with CMD value
INIT_CRC r_CrcCalc, r_PruXData
;; Read Status Register
LBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
;; Read Internal Status Register
LBBO &_InternalStatusReg, r_SharedMemoryBase, INTERNAL_STATUS_REGISTER_BASE, 4
;; Finish reading packet
READ_BYTE_CRC _PacketWord.b0, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord.b1, r_CrcCalc ; Address
;; SET_PRU_X_STATE g_TarStateIdx ; PRU-BB is already reading last byte, prep TAR state
SET_PRU_BB_STATE g_TarState, r_Mode
READ_BYTE _Crc.b0 ; CRC
;;; TAR+WAIT PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; (>=40 CCs)
;; Ensure CRC is good to go
CHECK_CRC r_CrcCalc, _Crc.b0
;; Prep write
;; SET_PRU_X_STATE g_WriteStateIdx
SET_PRU_BB_STATE g_WriteState, r_Mode
;; If the status register indicates there is no room in the RXQ
;; respond with FATAL_ERROR
QBBC SEND_FATAL_ERROR, r_StatusReg, STATUS_NP_FREE_BIT
;; Response to this packet will go into PC TXQ, so if PC TXQ
;; is full, alert master with a NON_FATAL_ERROR
QBBS SEND_NON_FATAL_ERROR, _InternalStatusReg, CHAN0_PC_TXQ_FULL_BIT
;; Populate PacketInfo with packet length (as read from PRU-BB) and magic number
LDI _PacketInfo.b0, ESPI_PACKET_MAGIC_NUMBER
SUB _PacketInfo.w1, r_PruYCount, 1 ; count includes CRC byte, dec by 1
;; Write packet to RX Buffer
;; (single-depth so no need to worry about queue pointer)
SBBO &_PacketInfo, r_SharedMemoryBase, CH0_NP_RX_BUFFER_BASE, 8
;; Update NP_FREE bit in Status Register
CLR r_StatusReg, r_StatusReg, STATUS_NP_FREE_BIT
SBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
XOUT BANK0, &r_StatusReg, 4
;; Alert host of new RX packet
LDI _Tmp0, ICSS_ESPI_IPC_MSG_RX_AVAIL
SBBO &_Tmp0, r_SharedMemoryBase, IPC_REGISTER_BASE, 4
RAISE_INTERRUPT_FOR_HOST
;;; RSP PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Respond with DEFER while Host processes the packet
JMP SEND_DEFER
;; Destroy local register names
.unasg _PacketInfo
.unasg _PacketWord
.unasg _InternalStatusReg
.unasg _Tmp0
.unasg _Crc
;-------------------------------------------------------------------
; Subroutine: PUT_IOWR_SHORT
; Description: Can probably combine with other short commands
;-------------------------------------------------------------------
PUT_IOWR_SHORT_1:
PUT_IOWR_SHORT_2:
PUT_IOWR_SHORT_4:
;; Define local register names
.asg r_Work0, _PacketInfo ; magic number + length + CMD (write when length known)
.asg r_Work1, _PacketWord0 ; actual packet
.asg r_Work2, _PacketWord1 ; actual packet
.asg r_Work3, _InternalStatusReg
.asg r_Work4, _Tmp0
.asg r_Work5, _Crc
;;; CMD PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin to build packet with CMD opcode value
MOV _PacketInfo.b3, r_PruXData
;; Set up CRC with CMD value
INIT_CRC r_CrcCalc, r_PruXData
;; Read Status Register
LBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
;; Read Internal Status Register
LBBO &_InternalStatusReg, r_SharedMemoryBase, INTERNAL_STATUS_REGISTER_BASE, 4
;; Finish reading packet
READ_BYTE_CRC _PacketWord0.b0, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord0.b1, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord0.b2, r_CrcCalc ; Data byte 1
QBEQ iowr_short_read_end, _PacketInfo.b3, 0x44 ; end 1 byte read
READ_BYTE_CRC _PacketWord0.b3, r_CrcCalc ; Data byte 2
QBEQ iowr_short_read_end, _PacketInfo.b3, 0x45 ; end 2 byte read
READ_BYTE_CRC _PacketWord1.b0, r_CrcCalc ; Data byte 3
READ_BYTE_CRC _PacketWord1.b1, r_CrcCalc ; Data byte 4
iowr_short_read_end:
;; SET_PRU_X_STATE g_TarStateIdx ; PRU-BB is already reading last byte, prep TAR state
SET_PRU_BB_STATE g_TarState, r_Mode
READ_BYTE _Crc.b0 ; CRC
;;; TAR+WAIT PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; (>=40 CCs)
;; Ensure CRC is good to go
CHECK_CRC r_CrcCalc, _Crc.b0
;; Prep write
;; SET_PRU_X_STATE g_WriteStateIdx
SET_PRU_BB_STATE g_WriteState, r_Mode
;; If the status register indicates there is no room in the RXQ
;; respond with FATAL_ERROR
QBBC SEND_FATAL_ERROR, r_StatusReg, STATUS_NP_FREE_BIT
;; Populate PacketInfo with packet length (as read from PRU-BB) and magic number
LDI _PacketInfo.b0, ESPI_PACKET_MAGIC_NUMBER
SUB _PacketInfo.w1, r_PruYCount, 1 ; count includes CRC byte, dec by 1
;; Write packet to RX Buffer
;; (single-depth so no need to worry about queue pointer)
;; always write all 12 bytes, the length field in the header will tell host actual length
SBBO &_PacketInfo, r_SharedMemoryBase, CH0_NP_RX_BUFFER_BASE, 12
;; Update NP_FREE bit in Status Register
CLR r_StatusReg, r_StatusReg, STATUS_NP_FREE_BIT
SBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
XOUT BANK0, &r_StatusReg, 4
;; Alert host of new RX packet
LDI _Tmp0, ICSS_ESPI_IPC_MSG_RX_AVAIL
SBBO &_Tmp0, r_SharedMemoryBase, IPC_REGISTER_BASE, 4
RAISE_INTERRUPT_FOR_HOST
;;; RSP PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Respond with ACCEPT, Host will handle the packet
JMP SEND_ACCEPT
;; Destroy local register names
.unasg _PacketInfo
.unasg _PacketWord0
.unasg _PacketWord1
.unasg _InternalStatusReg
.unasg _Tmp0
.unasg _Crc
;-------------------------------------------------------------------
; Subroutine: PUT_MEMRD32_SHORT_0
; Description: Can probably combine with other short commands
;-------------------------------------------------------------------
PUT_MEMRD32_SHORT_1:
PUT_MEMRD32_SHORT_2:
PUT_MEMRD32_SHORT_4:
;; Define local register names
.asg r_Work0, _PacketInfo ; magic number + length + CMD(write when length known)
.asg r_Work1, _PacketWord ; actual packet
.asg r_Work4, _InternalStatusReg
.asg r_Work5, _Tmp0
.asg r_Work3, _Crc
;;; CMD PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin to build packet with CMD opcode value
MOV _PacketInfo.b3, r_PruXData
;; Set up CRC with CMD value
INIT_CRC r_CrcCalc, r_PruXData
;; Read Status Register
LBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
;; Read Internal Status Register
LBBO &_InternalStatusReg, r_SharedMemoryBase, INTERNAL_STATUS_REGISTER_BASE, 4
;; Finish reading packet
READ_BYTE_CRC _PacketWord.b0, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord.b1, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord.b2, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord.b3, r_CrcCalc ; Address
;; SET_PRU_X_STATE g_TarStateIdx ; PRU-BB is already reading last byte, prep TAR state
SET_PRU_BB_STATE g_TarState, r_Mode
READ_BYTE _Crc.b0 ; CRC
;;; TAR+WAIT PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; (>=40 CCs)
;; Ensure CRC is good to go
CHECK_CRC r_CrcCalc, _Crc.b0
;; Prep write
;; SET_PRU_X_STATE g_WriteStateIdx
SET_PRU_BB_STATE g_WriteState, r_Mode
;; If the status register indicates there is no room in the RXQ
;; respond with FATAL_ERROR
QBBC SEND_FATAL_ERROR, r_StatusReg, STATUS_NP_FREE_BIT
;; Response to this packet will go into PC TXQ, so if PC TXQ
;; is full, alert master with a NON_FATAL_ERROR
QBBS SEND_NON_FATAL_ERROR, _InternalStatusReg, CHAN0_NP_TXQ_FULL_BIT
;; Populate PacketInfo with packet length (as read from PRU-BB) and magic number
LDI _PacketInfo.b0, ESPI_PACKET_MAGIC_NUMBER
SUB _PacketInfo.w1, r_PruYCount, 1 ; count includes CRC byte, dec by 1
;; Write packet to RX Buffer
;; (single-depth so no need to worry about queue pointer)
SBBO &_PacketInfo, r_SharedMemoryBase, CH0_NP_RX_BUFFER_BASE, 8
;; Update NP_FREE bit in Status Register
CLR r_StatusReg, r_StatusReg, STATUS_NP_FREE_BIT
SBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
XOUT BANK0, &r_StatusReg, 4
;; Alert host of new RX packet
LDI _Tmp0, ICSS_ESPI_IPC_MSG_RX_AVAIL
SBBO &_Tmp0, r_SharedMemoryBase, IPC_REGISTER_BASE, 4
RAISE_INTERRUPT_FOR_HOST
;;; RSP PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Respond with DEFER while Host processes the packet
JMP SEND_DEFER
;; Destroy local register names
.unasg _PacketInfo
.unasg _PacketWord
.unasg _InternalStatusReg
.unasg _Tmp0
.unasg _Crc
;-------------------------------------------------------------------
; Subroutine: SEND_NON_FATAL_ERROR
; Description: Respond with NON_FATAL_ERROR
;-------------------------------------------------------------------
SEND_NON_FATAL_ERROR:
;; Prepare NON_FATAL_ERROR response
LDI r_Work0.b0, g_NonFatalErrorResponseCode
;; RESPONSE PHASE
CLEAR_CRC r_CrcCalc
WRITE_BYTE_CRC r_Work0.b0, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b1, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b0, r_CrcCalc
;; SET_PRU_X_STATE g_EndStateIdx
;; SET_PRU_BB_STATE g_EndState, r_Zero
WRITE_CRC r_CrcCalc
SET_PRU_BB_STATE g_EndState, r_Zero
JMP END_STATE
;-------------------------------------------------------------------
; Subroutine: SEND_FATAL_ERROR
; Description: Respond with FATAL_ERROR
;-------------------------------------------------------------------
SEND_FATAL_ERROR:
;; Prepare FATAL_ERROR response
LDI r_Work0.b0, g_FatalErrorResponseCode
;; RESPONSE PHASE
CLEAR_CRC r_CrcCalc
WRITE_BYTE_CRC r_Work0.b0, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b1, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b0, r_CrcCalc
;; SET_PRU_X_STATE g_EndStateIdx
;; SET_PRU_BB_STATE g_EndState, r_Zero
WRITE_CRC r_CrcCalc
SET_PRU_BB_STATE g_EndState, r_Zero
JMP END_STATE
;-------------------------------------------------------------------
; Subroutine: END_STATE
; Description: Wait for PRU-BB to alert that CS has de-asserted properly
;-------------------------------------------------------------------
END_STATE:
;; Make sure PRU-BB is up to date with the status register known by master
XOUT BANK0, &r_StatusReg, 4
wait_for_flag:
JMP READY_STATE
XIN BANK0, &r_Flags, 2
QBEQ wait_for_flag, r_Flags, 0
;; continue on to handle flag
HANDLE_FLAG: ;; Only one flag for now.....keep it simple
FLAG_CS_DEASSERT_GOOD:
FLAG_CS_DEASSERT_BAD: ;; These flags are handled the same.......for now
;; Make sure PRU-BB is up to date with the status register known by master
XOUT BANK0, &r_StatusReg, 4 ; redundant? Yes, but just in case
;; Clear flags
LDI r_Flags, 0
XOUT BANK0, &r_Flags, 2
;; CS has been de-asserted so jump to Ready to wait for data
JMP READY_STATE
;-------------------------------------------------------------------
; Subroutine: PUT_MEMWR32_SHORT
; Description: Pass directly in PC Queue (can still probably be combined with other shorts)
;-------------------------------------------------------------------
PUT_MEMWR32_SHORT_1:
PUT_MEMWR32_SHORT_2:
PUT_MEMWR32_SHORT_4:
;; Define local register names
.asg r_Work0, _PacketInfo ; magic number + length + CMD(write when length known)
.asg r_Work1, _PacketWord0 ; actual packet
.asg r_Work2, _PacketWord1 ; actual packet
.asg r_Work4, _InternalStatusReg
.asg r_Work5, _Tmp0
.asg r_Work3, _Crc
;;; CMD PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin to build packet with CMD opcode value
MOV _PacketInfo.b3, r_PruXData
;; Set up CRC with CMD value
INIT_CRC r_CrcCalc, r_PruXData
;; Read Status Register
LBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
;; Read Internal Status Register
LBBO &_InternalStatusReg, r_SharedMemoryBase, INTERNAL_STATUS_REGISTER_BASE, 4
;; Finish reading packet
READ_BYTE_CRC _PacketWord0.b0, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord0.b1, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord0.b2, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord0.b3, r_CrcCalc ; Address
READ_BYTE_CRC _PacketWord1.b0, r_CrcCalc ; Data byte 1
QBEQ memwr_short_read_end, _PacketInfo.b3, 0x4C ; end 1 byte read
READ_BYTE_CRC _PacketWord1.b1, r_CrcCalc ; Data byte 2
QBEQ memwr_short_read_end, _PacketInfo.b3, 0x4D ; end 2 byte read
READ_BYTE_CRC _PacketWord1.b2, r_CrcCalc ; Data byte 3
READ_BYTE_CRC _PacketWord1.b3, r_CrcCalc ; Data byte 4
memwr_short_read_end:
;; SET_PRU_X_STATE g_TarStateIdx ; PRU-BB is already reading last byte, prep TAR state
SET_PRU_BB_STATE g_TarState, r_Mode
READ_BYTE _Crc.b0 ; CRC
;;; TAR+WAIT PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; (>=40 CCs)
;; Ensure CRC is good to go
CHECK_CRC r_CrcCalc, _Crc.b0
;; Prep write
;; SET_PRU_X_STATE g_WriteStateIdx
SET_PRU_BB_STATE g_WriteState, r_Mode
;; If the status register indicates there is no room in the RXQ
;; respond with FATAL_ERROR
QBBC SEND_FATAL_ERROR, r_StatusReg, STATUS_PC_FREE_BIT
;; Populate PacketInfo with packet length (as read from PRU-BB) and magic number
LDI _PacketInfo.b0, ESPI_PACKET_MAGIC_NUMBER
SUB _PacketInfo.w1, r_PruYCount, 1 ; count includes CRC byte, dec by 1
;; Write packet to RX Buffer
;; (single-depth so no need to worry about queue pointer)
LDI _Tmp0, CH0_PC_RX_BUFFER_BASE
SBBO &_PacketInfo, r_SharedMemoryBase, _Tmp0, 12
;; Update PC_FREE bit in Status Register
CLR r_StatusReg, r_StatusReg, STATUS_PC_FREE_BIT
SBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
XOUT BANK0, &r_StatusReg, 4
;; Alert host of new RX packet
LDI _Tmp0, ICSS_ESPI_IPC_MSG_RX_AVAIL
SBBO &_Tmp0, r_SharedMemoryBase, IPC_REGISTER_BASE, 4
RAISE_INTERRUPT_FOR_HOST
;;; RSP PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Respond with ACCEPT, Host will handle the packet
JMP SEND_ACCEPT
;; Destroy local register names
.unasg _PacketInfo
.unasg _PacketWord
.unasg _InternalStatusReg
.unasg _Tmp0
.unasg _Crc
;-------------------------------------------------------------------
; Subroutine: PUT_VWIRE
; Description:
;-------------------------------------------------------------------
PUT_VWIRE:
JMP NOT_IMPLEMENTED
;-------------------------------------------------------------------
; Subroutine: GET_VWIRE
; Description:
;-------------------------------------------------------------------
GET_VWIRE:
JMP NOT_IMPLEMENTED
;-------------------------------------------------------------------
; Subroutine: PUT_OOB
; Description:
;-------------------------------------------------------------------
PUT_OOB:
JMP NOT_IMPLEMENTED
;-------------------------------------------------------------------
; Subroutine: GET_OOB
; Description:
;-------------------------------------------------------------------
GET_OOB:
JMP NOT_IMPLEMENTED
;-------------------------------------------------------------------
; Subroutine: PUT_FLASH_C
; Description:
;-------------------------------------------------------------------
PUT_FLASH_C:
JMP NOT_IMPLEMENTED
;-------------------------------------------------------------------
; Subroutine: GET_FLASH_NP
; Description:
;-------------------------------------------------------------------
GET_FLASH_NP:
JMP NOT_IMPLEMENTED
;-------------------------------------------------------------------
; Subroutine: GET_STATUS
; Description: Respond with the status register
;-------------------------------------------------------------------
GET_STATUS:
.asg r_Work1, _Crc
;;; CMD PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SET_PRU_X_STATE g_TarStateIdx ; PRU-BB is already reading last byte, prep TAR state
SET_PRU_BB_STATE g_TarState, r_Mode
;; Set up CRC with CMD value
INIT_CRC r_CrcCalc,0x23
;; Finish reading packet
READ_BYTE _Crc.b0 ; CRC
;;; TAR+WAIT PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; (>=40 CCs)
;; Ensure CRC is good to go
CHECK_CRC r_CrcCalc, _Crc.b0
;; Prep write
;; SET_PRU_X_STATE g_WriteStateIdx
SET_PRU_BB_STATE g_WriteState, r_Mode
;; Read Status Register
LBBO &r_StatusReg, r_SharedMemoryBase, STATUS_REGISTER_BASE, 4
;;; RSP PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Write results
JMP SEND_ACCEPT
.unasg _Crc
;-------------------------------------------------------------------
; Subroutine: SET_CONFIGURATION
; Description: Set requested configuration register with provided value
;-------------------------------------------------------------------
SET_CONFIGURATION:
.asg r_Work0, _Crc
.asg r_Work1, _PacketAddr
.asg r_Work2, _PacketData
.asg r_Work3, _Response
.asg r_Work4, _Tmp0
.asg r_Work5, _GenCapConNew
.asg r_Work6, _Ch0CapConNew
.asg r_Work7, _ModeNew
;;; CMD PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Set up CRC with CMD value
INIT_CRC r_CrcCalc,0x22
;; Read fixed-length packet
READ_BYTE_CRC _PacketAddr.b1, r_CrcCalc ; Address
READ_BYTE_CRC _PacketAddr.b0, r_CrcCalc ; Address
READ_BYTE_CRC _PacketData.b0, r_CrcCalc ; Data
READ_BYTE_CRC _PacketData.b1, r_CrcCalc ; Data
READ_BYTE_CRC _PacketData.b2, r_CrcCalc ; Data
READ_BYTE_CRC _PacketData.b3, r_CrcCalc ; Data
;; SET_PRU_X_STATE g_TarStateIdx ; PruX is already reading last byte, prep TAR state
SET_PRU_BB_STATE g_TarState, r_Mode
READ_BYTE _Crc.b2 ; CRC
;;; TAR+WAIT PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; (>=40 CCs)
;; Ensure CRC is good to go
CHECK_CRC r_CrcCalc, _Crc.b2
;; Prep write
;; SET_PRU_X_STATE g_WriteStateIdx
SET_PRU_BB_STATE g_WriteState, r_Mode
;; Ensure address within valid range
LDI _Tmp0.w0, 0xFFF
QBGT SEND_FATAL_ERROR, _Tmp0.w0, _PacketAddr.w0
;; Check in order of complexity
QBEQ configure_general_cap_con, _PacketAddr.w0, 0x008
QBEQ configure_ch0_cap_con, _PacketAddr.w0, 0x010
;; Ignore any other request (no other channels are supported)
JMP SEND_ACCEPT
configure_general_cap_con:
MOV _GenCapConNew, r_GeneralCapCon
;; CRC Checking
UPDATE_BIT_FROM_REF _GenCapConNew, _PacketData, GENERAL_CAP_CON_CRC_CHECKING_ENABLE_OFFSET
;; Response Modifier
QBBS SEND_NON_FATAL_ERROR, _PacketData, GENERAL_CAP_CON_RESPONSE_MODIFIER_ENABLE_OFFSET
;; Alert Mode
QBBC SEND_NON_FATAL_ERROR, _PacketData, GENERAL_CAP_CON_ALERT_MODE_OFFSET
;; I/O Mode
UPDATE_BITS_FROM_REF _GenCapConNew, _PacketData, _Tmp0, (GENERAL_CAP_CON_IO_MODE_SELECT_MASK << GENERAL_CAP_CON_IO_MODE_SELECT_OFFSET)
;; Setup mode register for state jumps
LSR _ModeNew.w2, _Tmp0, (GENERAL_CAP_CON_IO_MODE_SELECT_OFFSET)
;; Open Drain Alert
;; CURRENTLY NOT CHECKING IF SUPPORTED (UNDEFINED BEHAVIOR)
;; Only one mode supported, so effectively just ignoring bad requests
;; Maximum Frequency
;; CURRENTLY NOT CHECKING IF SUPPORTED (UNDEFINED BEHAVIOR)
;; Only one mode supported, so effectively just ignoring bad requests
;; Maximum WAIT_STATE
;; Changing configuration, but effectively ignored
UPDATE_BITS_FROM_REF _GenCapConNew, _PacketData, _Tmp0, (GENERAL_CAP_CON_MAXIMUM_WAIT_STATE_ALLOWED_MASK << GENERAL_CAP_CON_MAXIMUM_WAIT_STATE_ALLOWED_OFFSET)
;; Send ACCEPT and set return location for successful write
JAL r_LinkReg, send_accept_sc
;; Upon return, update local and global slave register
MOV r_Mode, _ModeNew.w2
MOV r_GeneralCapCon, _GenCapConNew
SBBO &r_GeneralCapCon, r_SharedMemoryBase, GENERAL_CAP_CON_REGISTER_BASE, 4
JMP READY_STATE
configure_ch0_cap_con:
MOV _Ch0CapConNew, r_Ch0CapCon
;; Read Request Size
;; CURRENTLY NOT CHECKING IF SUPPORTED (UNDEFINED BEHAVIOR)
;; Only one mode supported, so effectively just ignoring bad requests
;; Payload size
;; CURRENTLY NOT CHECKING IF SUPPORTED (UNDEFINED BEHAVIOR)
;; Only one mode supported, so effectively just ignoring bad requests
;; Bus Master Enable
;; ??
;; Must be no non-posted cycle pending completion
;; Enable
UPDATE_BITS_FROM_REF _Ch0CapConNew, _PacketData, _Tmp0, (PERIPHERAL_CHAN_ENABLE_MASK << PERIPHERAL_CHAN_ENABLE_OFFSET)
;; Send ACCEPT and set return location for successful write
JAL r_LinkReg, send_accept_sc
;; Upon return, update local and global slave register
MOV r_Ch0CapCon, _Ch0CapConNew
SBBO &r_Ch0CapCon, r_SharedMemoryBase, CHAN0_CAP_CON_REGISTER_BASE, 4
JMP READY_STATE
;;; RSP PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
send_accept_sc:
;; Prepare ACCEPT response
LDI _Response.b0, g_AcceptResponseCode
;; RESPONSE PHASE
CLEAR_CRC r_CrcCalc
WRITE_BYTE_CRC _Response.b0, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b1, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b0, r_CrcCalc
;; SET_PRU_X_STATE g_EndStateIdx
;; SET_PRU_BB_STATE g_EndState, r_Zero
WRITE_CRC r_CrcCalc
SET_PRU_BB_STATE g_EndState, r_Zero
;; Need a special end state for SET_CONFIGURATION to apply configurations after CS# de-asserts
end_state_sc:
wait_for_flag_sc:
XIN BANK0, &r_Flags, 4
QBEQ wait_for_flag_sc, r_Flags, 0
;; continue on to handle flag
HANDLE_FLAG_SC: ;; Only one flag possible here, as we've actually reached the end state
;; Clear flags
LDI r_Flags, 0
XOUT BANK0, &r_Flags, 4
;; CS has been de-asserted so jump back to finalize configuration
JMP r_LinkReg
.unasg _Crc
.unasg _PacketAddr
.unasg _PacketData
.unasg _Response
.unasg _Tmp0
.unasg _GenCapConNew
.unasg _Ch0CapConNew
.unasg _ModeNew
;-------------------------------------------------------------------
; Subroutine: GET_CONFIGURATION
; Description: Respond with requested configuration register
;-------------------------------------------------------------------
GET_CONFIGURATION:
.asg r_Work0, _Crc
.asg r_Work1, _Packet
.asg r_Work2, _SlaveReg
.asg r_Work3, _Tmp0
;;; CMD PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Set up CRC with CMD value
INIT_CRC r_CrcCalc, 0x21
;; Read fixed-length packet
READ_BYTE_CRC _Packet.b1, r_CrcCalc ; Address
READ_BYTE_CRC _Packet.b0, r_CrcCalc ; Address
;; SET_PRU_X_STATE g_TarStateIdx ; PruX is already reading last byte, prep TAR state
SET_PRU_BB_STATE g_TarState, r_Mode
READ_BYTE _Crc.b0 ; CRC
;;; TAR+WAIT PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; (>=40 CCs)
;; Ensure CRC is good to go
CHECK_CRC r_CrcCalc, _Crc.b0
;; Prep write
;; SET_PRU_X_STATE g_WriteStateIdx
SET_PRU_BB_STATE g_WriteState, r_Mode
;; Ensure address within valid range
LDI _Tmp0.w0, 0xFFF
QBGT SEND_FATAL_ERROR, _Tmp0.w0, _Packet.w0
;; We have a bunch of extra cycles to process these unsupported channels
;; so this is unoptimized for now
QBEQ read_ch1_cap_con, _Packet.w0, 0x020
QBEQ read_ch2_cap_con, _Packet.w0, 0x030
QBEQ read_ch3_cap_con, _Packet.w0, 0x040
QBEQ read_device_id, _Packet.w0, 0x004
QBEQ read_general_cap_con, _Packet.w0, 0x008
QBEQ read_ch0_cap_con, _Packet.w0, 0x010
;; Address is RESERVED, respond with ZERO
LDI32 _SlaveReg, 0x00000000
JMP send_slave_register
read_device_id:
MOV _SlaveReg, r_DeviceId
JMP send_slave_register
read_general_cap_con:
MOV _SlaveReg, r_GeneralCapCon
JMP send_slave_register
read_ch0_cap_con:
MOV _SlaveReg, r_Ch0CapCon
JMP send_slave_register
read_ch1_cap_con:
LBBO &_SlaveReg, r_SharedMemoryBase, CHAN1_CAP_CON_REGISTER_BASE, 4
JMP send_slave_register
read_ch2_cap_con:
LBBO &_SlaveReg, r_SharedMemoryBase, CHAN2_CAP_CON_REGISTER_BASE, 4
JMP send_slave_register
read_ch3_cap_con:
LBBO &_SlaveReg, r_SharedMemoryBase, CHAN3_CAP_CON_REGISTER_BASE, 4
JMP send_slave_register
send_slave_register:
;; Prep ACCEPT response
LDI _Tmp0.b0, g_AcceptResponseCode
;;; RSP PHASE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Write results
CLEAR_CRC r_CrcCalc
WRITE_BYTE_CRC _Tmp0.b0, r_CrcCalc
WRITE_BYTE_CRC _SlaveReg.b0, r_CrcCalc
WRITE_BYTE_CRC _SlaveReg.b1, r_CrcCalc
WRITE_BYTE_CRC _SlaveReg.b2, r_CrcCalc
WRITE_BYTE_CRC _SlaveReg.b3, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b1, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b0, r_CrcCalc
;; SET_PRU_X_STATE g_EndStateIdx
;; SET_PRU_BB_STATE g_EndState, r_Zero
WRITE_CRC r_CrcCalc
SET_PRU_BB_STATE g_EndState, r_Zero
;; FIN
JMP END_STATE
.unasg _Crc
.unasg _Packet
.unasg _SlaveReg
.unasg _Tmp0
;-------------------------------------------------------------------
; Subroutine: RESET
; Description: Reset the slave registers
;-------------------------------------------------------------------
RESET:
;; Reset all slave registers to default values
RESET_SLAVE_REGISTERS
JMP END_STATE
;-------------------------------------------------------------------
; Subroutine: NO_RESPONSE
; Description: Just wait for CS to de-assert and then head to Ready state
;-------------------------------------------------------------------
NO_RESPONSE:
JMP END_STATE
;-------------------------------------------------------------------
; Subroutine: SEND_DEFER
; Description: Respond with DEFER
;-------------------------------------------------------------------
SEND_DEFER:
;; Prepare DEFER response
LDI r_Work0.b0, g_DeferResponseCode
;; RESPONSE PHASE
CLEAR_CRC r_CrcCalc
WRITE_BYTE_CRC r_Work0.b0, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b1, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b0, r_CrcCalc
;; SET_PRU_X_STATE g_EndStateIdx
;; SET_PRU_BB_STATE g_EndState, r_Zero
WRITE_CRC r_CrcCalc
SET_PRU_BB_STATE g_EndState, r_Zero
JMP END_STATE
;-------------------------------------------------------------------
; Subroutine: SEND_ACCEPT
; Description: Respond with ACCEPT
;-------------------------------------------------------------------
SEND_ACCEPT:
;; Prepare ACCEPT response
LDI r_Work0.b0, g_AcceptResponseCode
;; LDI r_Work0.w0, 0xAADD
;; RESPONSE PHASE
CLEAR_CRC r_CrcCalc
WRITE_BYTE_CRC r_Work0.b0, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b1, r_CrcCalc
WRITE_BYTE_CRC r_StatusReg.b0, r_CrcCalc
;; SET_PRU_X_STATE g_EndStateIdx
WRITE_CRC r_CrcCalc
SET_PRU_BB_STATE g_EndState, r_Zero
JMP END_STATE
;-------------------------------------------------------------------
; Subroutine: NOT_IMPLEMENTED
; Description: Temporary trap for unimplemented functions
;-------------------------------------------------------------------
NOT_IMPLEMENTED:
JMP NO_RESPONSE
;-------------------------------------------------------------------
; Subroutine: ERROR_CRC_MISMATCH
; Description: Temporary trap for CRC mismatch error
;-------------------------------------------------------------------
ERROR_CRC_MISMATCH:
JMP NO_RESPONSE
| 33.603143 | 159 | 0.663266 |
e613904c30165753a1be1b33da13c4d4f1b15345 | 1,629 | go | Go | cmd/gk/command/merkle.go | funkygao/gafka | 077b43fb2687eb43715b32c59896cb40bc68a4e3 | [
"Apache-2.0"
] | 98 | 2015-11-13T10:50:51.000Z | 2022-01-11T14:26:51.000Z | cmd/gk/command/merkle.go | funkygao/gafka | 077b43fb2687eb43715b32c59896cb40bc68a4e3 | [
"Apache-2.0"
] | 12 | 2016-03-01T20:20:34.000Z | 2017-03-21T00:54:12.000Z | cmd/gk/command/merkle.go | funkygao/gafka | 077b43fb2687eb43715b32c59896cb40bc68a4e3 | [
"Apache-2.0"
] | 26 | 2016-03-02T01:11:38.000Z | 2022-02-03T13:49:06.000Z | package command
import (
"crypto/md5"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/funkygao/gocli"
"github.com/funkygao/golib/merkle"
)
type Merkle struct {
Ui cli.Ui
Cmd string
root string
}
func (this *Merkle) Run(args []string) (exitCode int) {
cmdFlags := flag.NewFlagSet("merkle", flag.ContinueOnError)
cmdFlags.Usage = func() { this.Ui.Output(this.Help()) }
if err := cmdFlags.Parse(args); err != nil {
return 1
}
if len(args) == 0 {
this.Ui.Error("missing path")
return 2
}
this.root = args[len(args)-1]
if _, err := os.Stat(this.root); err != nil {
this.Ui.Error(err.Error())
return 1
}
this.showHash()
return
}
func (this *Merkle) showHash() {
var blocks [][]byte
swallow(filepath.Walk(this.root, func(path string, f os.FileInfo, err error) error {
if f == nil {
return err
}
if f.IsDir() {
return nil
}
data, err := ioutil.ReadFile(path)
if err != nil {
return err
}
blocks = append(blocks, data)
return nil
}))
tree := merkle.NewTree()
swallow(tree.Generate(blocks, md5.New()))
this.Ui.Outputf("height: %d", tree.Height())
for h := 1; h <= int(tree.Height()); h++ {
format := fmt.Sprintf("%%%ds ", (h-1)*4)
format += "%+v"
nodes := tree.GetNodesAtHeight(uint64(h))
for _, node := range nodes {
this.Ui.Outputf(format, "", node.Hash)
}
}
}
func (*Merkle) Synopsis() string {
return "Recursively calculate hash of directory with merkle tree"
}
func (this *Merkle) Help() string {
help := fmt.Sprintf(`
Usage: %s merkle path
%s
`, this.Cmd, this.Synopsis())
return strings.TrimSpace(help)
}
| 17.706522 | 85 | 0.63229 |
b98805e5b5094f78d6bcd4fe0f0d65b11c5b5ebe | 2,524 | sql | SQL | sql/relations_only.sql | bzed/pglogical | 4d53ca43d7610d76adad977937338c883bc59067 | [
"PostgreSQL"
] | null | null | null | sql/relations_only.sql | bzed/pglogical | 4d53ca43d7610d76adad977937338c883bc59067 | [
"PostgreSQL"
] | 1 | 2020-02-17T17:39:59.000Z | 2020-02-17T17:40:59.000Z | sql/relations_only.sql | bigsql/spock | 8215c664c8e9ab919389719e1f61ca5cc42cbbd5 | [
"PostgreSQL"
] | null | null | null | -- This should be done with pg_regress's --create-role option
-- but it's blocked by bug 37906
SELECT * FROM pglogical_regress_variables()
\gset
\c :provider_dsn
SET client_min_messages = 'warning';
CREATE SCHEMA relations_only;
CREATE TABLE relations_only.rel_only(id int primary key);
CREATE TABLE relations_only.rel_seq(id serial primary key);
CREATE SEQUENCE relations_only.seq_only;
CREATE TABLE relations_only.no_rel_only(id int primary key);
CREATE TABLE relations_only.no_rel_seq(id serial primary key);
CREATE SEQUENCE relations_only.no_seq_only;
SELECT * FROM pglogical.create_replication_set('repset_relations_only');
SELECT * FROM pglogical.replication_set_add_table('repset_relations_only', 'relations_only.rel_only', true);
SELECT * FROM pglogical.replication_set_add_table('repset_relations_only', 'relations_only.rel_seq', true);
SELECT * FROM pglogical.replication_set_add_sequence('repset_relations_only', 'relations_only.seq_only', true);
-- test adding a sequence with add_all_sequences (special case to get schema and
-- relation names)
CREATE SEQUENCE test_sequence;
SELECT * FROM pglogical.replication_set_add_all_sequences('repset_relations_only', '{public}');
\c :subscriber_dsn
SET client_min_messages = 'warning';
CREATE SCHEMA relations_only;
BEGIN;
SELECT * FROM pglogical.create_subscription(
subscription_name := 'test_subscription_relations_only',
provider_dsn := (SELECT provider_dsn FROM pglogical_regress_variables()) || ' user=super',
synchronize_structure := 'relations_only',
forward_origins := '{}',
replication_sets := '{repset_relations_only}');
COMMIT;
BEGIN;
SET LOCAL statement_timeout = '30s';
SELECT pglogical.wait_for_subscription_sync_complete('test_subscription_relations_only');
COMMIT;
select table_name from information_schema.tables where table_schema = 'relations_only' order by 1;
select sequence_name from information_schema.sequences where sequence_schema = 'relations_only' order by 1;
select sequence_name from information_schema.sequences where sequence_name = 'test_sequence' order by 1;
SELECT sync_kind, sync_subid, sync_nspname, sync_relname, sync_status IN ('y', 'r') FROM pglogical.local_sync_status ORDER BY 2,3,4;
SELECT * FROM pglogical.drop_subscription('test_subscription_relations_only');
DROP SCHEMA relations_only CASCADE;
DROP SEQUENCE test_sequence CASCADE;
\c :provider_dsn
SELECT * FROM pglogical.drop_replication_set('repset_relations_only');
DROP SCHEMA relations_only CASCADE;
DROP SEQUENCE test_sequence CASCADE;
| 42.779661 | 132 | 0.815372 |
d6b8a1a1b5fb3a8cf56c5f934b918c513e560f34 | 2,234 | sql | SQL | data/tables.sql | gonzus/lomito | e779ee8699b9db009898f599b69072093cb32737 | [
"MIT"
] | null | null | null | data/tables.sql | gonzus/lomito | e779ee8699b9db009898f599b69072093cb32737 | [
"MIT"
] | null | null | null | data/tables.sql | gonzus/lomito | e779ee8699b9db009898f599b69072093cb32737 | [
"MIT"
] | null | null | null | DROP TABLE IF EXISTS continents;
CREATE TABLE continents (
id int unsigned AUTO_INCREMENT NOT NULL,
name varchar(100) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY name (name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS countries;
CREATE TABLE countries (
id int unsigned AUTO_INCREMENT NOT NULL,
name varchar(100) NOT NULL,
continent_id int unsigned NOT NULL,
iso2 char(2) NOT NULL,
iso3 char(3) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY name_continent (name, continent_id),
UNIQUE KEY iso2 (iso2),
UNIQUE KEY iso3 (iso3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS regions;
CREATE TABLE regions (
id int unsigned AUTO_INCREMENT NOT NULL,
name varchar(100) NOT NULL,
country_id int unsigned NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY name_country (name, country_id),
KEY country (country_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS cities;
CREATE TABLE cities (
id int unsigned AUTO_INCREMENT NOT NULL,
name varchar(100) NOT NULL,
region_id int unsigned NOT NULL,
country_id int unsigned NOT NULL,
lat double NOT NULL,
lon double NOT NULL,
population int unsigned NOT NULL,
external_id varchar(20) CHARACTER SET ASCII NULL,
PRIMARY KEY (id),
UNIQUE KEY name_region (name, region_id),
KEY name_country (name, country_id),
KEY region (region_id),
KEY country (country_id),
KEY external (external_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
| 42.150943 | 63 | 0.487466 |
04ac6a0fe0454efe936079e573cc17abf9a90288 | 12,948 | java | Java | src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java | T3sT3ro/Create | b0712297310ea2bd322f6e824516c814525995d9 | [
"MIT"
] | 1 | 2021-07-18T05:35:15.000Z | 2021-07-18T05:35:15.000Z | src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java | T3sT3ro/Create | b0712297310ea2bd322f6e824516c814525995d9 | [
"MIT"
] | null | null | null | src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java | T3sT3ro/Create | b0712297310ea2bd322f6e824516c814525995d9 | [
"MIT"
] | 1 | 2021-07-12T06:41:40.000Z | 2021-07-12T06:41:40.000Z | package com.simibubi.create.foundation.ponder.content;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
import com.simibubi.create.content.logistics.block.depot.DepotTileEntity;
import com.simibubi.create.foundation.ponder.ElementLink;
import com.simibubi.create.foundation.ponder.SceneBuilder;
import com.simibubi.create.foundation.ponder.SceneBuildingUtil;
import com.simibubi.create.foundation.ponder.Selection;
import com.simibubi.create.foundation.ponder.elements.BeltItemElement;
import com.simibubi.create.foundation.ponder.elements.EntityElement;
import com.simibubi.create.foundation.ponder.elements.InputWindowElement;
import com.simibubi.create.foundation.ponder.elements.ParrotElement;
import com.simibubi.create.foundation.ponder.elements.ParrotElement.FlappyPose;
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
import com.simibubi.create.foundation.ponder.instructions.EmitParticlesInstruction.Emitter;
import com.simibubi.create.foundation.utility.Pointing;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
public class FanScenes {
public static void direction(SceneBuilder scene, SceneBuildingUtil util) {
scene.title("fan_direction", "Air flow of Encased Fans");
scene.configureBasePlate(0, 1, 5);
scene.world.showSection(util.select.layer(0), Direction.UP);
scene.idle(5);
scene.world.showSection(util.select.fromTo(3, 1, 0, 3, 1, 5)
.add(util.select.position(3, 2, 4)), Direction.DOWN);
scene.world.showSection(util.select.fromTo(2, 1, 5, 1, 1, 5), Direction.DOWN);
scene.idle(10);
BlockPos fanPos = util.grid.at(1, 1, 4);
scene.world.showSection(util.select.position(fanPos), Direction.SOUTH);
scene.idle(40);
scene.effects.rotationDirectionIndicator(fanPos.south());
ElementLink<ParrotElement> flappyBirb = scene.special.createBirb(util.vector.topOf(1, 0, 3), FlappyPose::new);
scene.idle(2);
scene.special.rotateParrot(flappyBirb, 0, 235, 0, 30);
scene.special.moveParrot(flappyBirb, util.vector.of(0, 0, -2.5), 30);
scene.idle(20);
scene.overlay.showText(80)
.text("Encased Fans use Rotational Force to create an Air Current")
.attachKeyFrame()
.placeNearTarget()
.pointAt(util.vector.topOf(fanPos));
scene.idle(90);
BlockPos leverPos = util.grid.at(3, 2, 4);
Selection reverse = util.select.fromTo(3, 1, 5, 1, 1, 4);
scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.down()));
scene.effects.indicateRedstone(leverPos);
scene.addKeyframe();
scene.world.modifyKineticSpeed(reverse, f -> -f);
scene.effects.rotationDirectionIndicator(fanPos.south());
scene.special.rotateParrot(flappyBirb, 0, 215 * 2, 0, 30);
scene.special.moveParrot(flappyBirb, util.vector.of(0, 0, 2.5), 30);
scene.idle(31);
scene.overlay.showText(60)
.text("Strength and Direction of Flow depends on the Rotational Input")
.placeNearTarget()
.pointAt(util.vector.topOf(fanPos));
scene.markAsFinished();
scene.idle(70);
scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.down()));
scene.effects.indicateRedstone(leverPos);
scene.world.modifyKineticSpeed(reverse, f -> -f);
scene.world.modifyKineticSpeed(util.select.everywhere(), f -> 4 * f);
scene.effects.rotationSpeedIndicator(fanPos.south());
scene.special.rotateParrot(flappyBirb, 0, 245 * 4, 0, 30);
scene.special.moveParrot(flappyBirb, util.vector.of(0, 0, -20), 30);
}
public static void processing(SceneBuilder scene, SceneBuildingUtil util) {
scene.title("fan_processing", "Processing Items using Encased Fans");
scene.configureBasePlate(1, 0, 5);
scene.world.showSection(util.select.layer(0)
.substract(util.select.position(0, 0, 4)), Direction.UP);
scene.idle(5);
scene.world.showSection(util.select.fromTo(6, 1, 2, 5, 1, 2)
.add(util.select.position(1, 1, 2)), Direction.DOWN);
scene.idle(25);
BlockPos blockPos = util.grid.at(4, 1, 2);
// blasting start
ElementLink<WorldSectionElement> blockInFront =
scene.world.showIndependentSection(util.select.position(3, 1, 0), Direction.SOUTH);
scene.world.moveSection(blockInFront, util.vector.of(1, 0, 2), 0);
scene.world.setBlock(blockPos, Blocks.LAVA.getDefaultState(), false);
scene.idle(10);
scene.overlay.showSelectionWithText(util.select.fromTo(blockPos, blockPos.west(2)), 80)
.colored(PonderPalette.RED)
.text("When passing through lava, the Air Flow becomes Heated");
scene.idle(80);
ItemStack stack = new ItemStack(Items.GOLD_ORE);
ItemStack smelted = new ItemStack(Items.GOLD_INGOT);
ElementLink<EntityElement> entityLink = scene.world.createItemEntity(util.vector.centerOf(blockPos.west(2)
.up(2)), util.vector.of(0, 0.1, 0), stack);
scene.idle(15);
scene.world.modifyEntity(entityLink, e -> e.setMotion(-0.2f, 0, 0));
Vector3d itemVec = util.vector.blockSurface(util.grid.at(1, 1, 2), Direction.EAST)
.add(0.1, 0, 0);
scene.overlay.showControls(new InputWindowElement(itemVec, Pointing.DOWN).withItem(stack), 20);
scene.idle(20);
scene.effects.emitParticles(itemVec.add(0, 0.2f, 0), Emitter.simple(ParticleTypes.LARGE_SMOKE, Vector3d.ZERO), 1,
60);
scene.overlay.showText(80)
.colored(PonderPalette.WHITE)
.pointAt(itemVec)
.placeNearTarget()
.attachKeyFrame()
.text("Items caught in the area will be smelted");
scene.idle(60);
scene.world.modifyEntities(ItemEntity.class, ie -> ie.setItem(smelted));
scene.idle(40);
scene.overlay.showControls(new InputWindowElement(itemVec, Pointing.DOWN).withItem(smelted), 20);
scene.idle(20);
scene.world.modifyEntities(ItemEntity.class, Entity::remove);
scene.idle(20);
scene.overlay.showText(80)
.colored(PonderPalette.RED)
.pointAt(itemVec)
.placeNearTarget()
.text("Food items thrown here would be incinerated");
scene.idle(40);
// smoking start
BlockState campfire = Blocks.FIRE.getDefaultState();
scene.world.hideIndependentSection(blockInFront, Direction.NORTH);
scene.idle(15);
scene.world.setBlock(util.grid.at(3, 1, 0), campfire, false);
scene.world.setBlock(blockPos, campfire, true);
blockInFront = scene.world.showIndependentSection(util.select.position(3, 1, 0), Direction.NORTH);
scene.world.moveSection(blockInFront, util.vector.of(1, 0, 2), 0);
scene.idle(50);
scene.overlay.showSelectionWithText(util.select.fromTo(blockPos, blockPos.west(2)), 60)
.colored(PonderPalette.BLACK)
.attachKeyFrame()
.text("Instead, a setup for Smoking using Fire should be used for them");
scene.idle(80);
// washing start
BlockState water = Blocks.WATER.getDefaultState();
scene.world.hideIndependentSection(blockInFront, Direction.NORTH);
scene.idle(15);
scene.world.setBlock(util.grid.at(3, 1, 0), water, false);
scene.world.setBlock(blockPos, water, true);
blockInFront = scene.world.showIndependentSection(util.select.position(3, 1, 0), Direction.NORTH);
scene.world.moveSection(blockInFront, util.vector.of(1, 0, 2), 0);
scene.idle(20);
scene.overlay.showSelectionWithText(util.select.fromTo(blockPos, blockPos.west(2)), 60)
.colored(PonderPalette.MEDIUM)
.attachKeyFrame()
.text("Air Flows passing through water create a Washing Setup");
scene.idle(70);
stack = AllItems.CRUSHED_GOLD.asStack();
ItemStack washed = new ItemStack(Items.GOLD_NUGGET, 16);
entityLink = scene.world.createItemEntity(util.vector.centerOf(blockPos.west(2)
.up(2)), util.vector.of(0, 0.1, 0), stack);
scene.idle(15);
scene.world.modifyEntity(entityLink, e -> e.setMotion(-0.2f, 0, 0));
scene.overlay.showControls(new InputWindowElement(itemVec, Pointing.DOWN).withItem(stack), 20);
scene.idle(20);
scene.effects.emitParticles(itemVec.add(0, 0.2f, 0), Emitter.simple(ParticleTypes.SPIT, Vector3d.ZERO), 1, 60);
scene.overlay.showText(50)
.colored(PonderPalette.WHITE)
.pointAt(itemVec)
.placeNearTarget()
.text("Some interesting new processing can be done with it");
scene.idle(60);
scene.world.modifyEntities(ItemEntity.class, ie -> ie.setItem(washed));
scene.overlay.showControls(new InputWindowElement(itemVec, Pointing.DOWN).withItem(washed), 20);
scene.idle(20);
scene.world.modifyEntities(ItemEntity.class, Entity::remove);
scene.idle(20);
scene.overlay.showText(100)
.colored(PonderPalette.RED)
.pointAt(util.vector.topOf(blockPos.east()))
.placeNearTarget()
.attachKeyFrame()
.text("The Speed of the Fan does NOT affect the processing speed, only its range");
scene.world.destroyBlock(util.grid.at(1, 1, 2));
scene.idle(110);
ElementLink<WorldSectionElement> cogs = scene.world.makeSectionIndependent(util.select.fromTo(6, 1, 2, 6, 0, 3)
.add(util.select.fromTo(4, 0, 2, 5, 0, 2)));
scene.world.modifyKineticSpeed(util.select.position(5, 2, 2), f -> f / 3f);
scene.world.moveSection(cogs, util.vector.of(0, 1, 0), 15);
scene.world.moveSection(blockInFront, util.vector.of(0, 1, 0), 15);
scene.world.destroyBlock(blockPos.east());
scene.world.showSection(util.select.position(blockPos.east()
.up()), Direction.DOWN);
scene.world.setBlock(blockPos.up(), Blocks.WATER.getDefaultState(), false);
ItemStack sand = new ItemStack(Items.SAND);
ItemStack clay = new ItemStack(Items.CLAY_BALL);
scene.idle(20);
BlockPos depos = util.grid.at(3, 4, 2);
ElementLink<WorldSectionElement> depot =
scene.world.showIndependentSection(util.select.position(depos), Direction.DOWN);
scene.world.moveSection(depot, util.vector.of(-1, -3, 0), 0);
scene.world.createItemOnBeltLike(depos, Direction.NORTH, sand);
scene.idle(10);
Vector3d depotTop = util.vector.topOf(2, 1, 2)
.add(0, 0.25, 0);
scene.effects.emitParticles(depotTop, Emitter.simple(ParticleTypes.SPIT, Vector3d.ZERO), .5f, 30);
scene.idle(30);
scene.world.modifyTileNBT(util.select.position(depos), DepotTileEntity.class,
nbt -> nbt.put("HeldItem", new TransportedItemStack(clay).serializeNBT()));
scene.effects.emitParticles(depotTop, Emitter.simple(ParticleTypes.SPIT, Vector3d.ZERO), .5f, 30);
scene.overlay.showText(90)
.pointAt(depotTop)
.attachKeyFrame()
.text("Fan Processing can also be applied to Items on Depots and Belts");
scene.idle(100);
scene.world.moveSection(depot, util.vector.of(-1, 0, 0), 15);
scene.idle(15);
ElementLink<WorldSectionElement> largeCog =
scene.world.showIndependentSection(util.select.position(1, 2, 4), Direction.UP);
ElementLink<WorldSectionElement> belt =
scene.world.showIndependentSection(util.select.fromTo(3, 3, 1, 1, 3, 3), Direction.DOWN);
scene.world.moveSection(largeCog, util.vector.of(-1, -2, 0), 0);
scene.world.moveSection(belt, util.vector.of(-1, -2, 0), 0);
ElementLink<BeltItemElement> transported =
scene.world.createItemOnBelt(util.grid.at(3, 3, 3), Direction.SOUTH, sand);
scene.idle(60);
scene.effects.emitParticles(depotTop, Emitter.simple(ParticleTypes.SPIT, Vector3d.ZERO), .5f, 25);
scene.idle(25);
scene.world.changeBeltItemTo(transported, new ItemStack(Items.CLAY_BALL));
scene.effects.emitParticles(depotTop, Emitter.simple(ParticleTypes.SPIT, Vector3d.ZERO), .5f, 25);
scene.idle(60);
scene.world.setKineticSpeed(util.select.position(1, 2, 4)
.add(util.select.fromTo(3, 3, 1, 1, 3, 3)), 0);
}
public static void source(SceneBuilder scene, SceneBuildingUtil util) {
scene.title("fan_source", "Generating Rotational Force using Encased Fans");
scene.configureBasePlate(0, 0, 5);
scene.world.showSection(util.select.layer(0), Direction.UP);
scene.idle(5);
scene.world.showSection(util.select.layer(1), Direction.DOWN);
scene.idle(10);
scene.world.showSection(util.select.layersFrom(2), Direction.DOWN);
scene.idle(10);
BlockPos rightFan = util.grid.at(1, 2, 2);
scene.overlay.showText(70)
.text("Fans facing down into a source of heat can provide Rotational Force")
.placeNearTarget()
.pointAt(util.vector.blockSurface(rightFan, Direction.WEST));
scene.idle(80);
scene.addKeyframe();
for (BlockPos pos : new BlockPos[] { rightFan, util.grid.at(3, 2, 2) }) {
scene.idle(10);
scene.world.toggleRedstonePower(util.select.position(pos.north()));
scene.effects.indicateRedstone(pos.north());
scene.world.setKineticSpeed(util.select.fromTo(pos, pos.up()), 4);
scene.effects.rotationSpeedIndicator(pos.up());
}
scene.overlay.showText(90)
.text("When given a Redstone Signal, the Fans will start providing power")
.colored(PonderPalette.RED)
.placeNearTarget()
.pointAt(util.vector.blockSurface(rightFan, Direction.WEST));
scene.markAsFinished();
}
}
| 42.313725 | 115 | 0.742663 |
882af3ec9addf89a9e1dc1d669d0b445420882da | 2,177 | swift | Swift | EcoSoapBank/Networking/GraphQLMutations.swift | DeVitoC/Labs25-Ecosoap-TeamA-IOS | 1e091e666ea72b7371ee9b85eb57cd579e1d3b79 | [
"MIT"
] | 2 | 2020-10-26T06:21:51.000Z | 2021-09-11T01:05:53.000Z | EcoSoapBank/Networking/GraphQLMutations.swift | DeVitoC/Labs25-Ecosoap-TeamA-IOS | 1e091e666ea72b7371ee9b85eb57cd579e1d3b79 | [
"MIT"
] | 7 | 2020-08-09T13:31:46.000Z | 2020-09-15T20:37:03.000Z | EcoSoapBank/Networking/GraphQLMutations.swift | DeVitoC/Labs25-Ecosoap-TeamA-IOS | 1e091e666ea72b7371ee9b85eb57cd579e1d3b79 | [
"MIT"
] | 3 | 2020-09-25T19:01:03.000Z | 2021-02-19T17:08:57.000Z | //
// GraphQLMutations.swift
// EcoSoapBank
//
// Created by Christopher Devito on 8/12/20.
// Copyright © 2020 Spencer Curtis. All rights reserved.
//
import Foundation
enum GraphQLMutations {
// MARK: - Mutations
/* works with variables as:
{
"input": {
"email": "email@here.com",
"password": "passwordHere"
}
}
*/
static let login = """
mutation LogIn($input: LogInInput) {
logIn(input: $input) {
user {
\(QueryObjects.user)
}
}
}
"""
static let updateUserProfile = """
mutation UpdateUserProfile($input: UpdateUserProfileInput) {
updateUserProfile(input: $input) {
user {
\(QueryObjects.user)
}
}
}
"""
static let updateProperty = """
mutation UpdateProperty($input: UpdatePropertyInput) {
updateProperty(input: $input) {
property {
\(QueryObjects.property)
}
}
}
"""
/* works with variables as:
{
"input": {
"collectionType":"enum:Pickup.CollectionType",
"status":"enum:Pickup.Status",
"readyDate":"Date()",
"PickupDate":"Date()"?,
"propertyId":"ID",
"cartons":["PickupCartonInput": {
"product":"enum:HospitalityService"?,
"weight":"Int"?
}],
"notes":"NotesGoHere"?
}
}
*/
static let schedulePickup = """
mutation SchedulePickup($input: SchedulePickupInput) {
schedulePickup(input: $input) {
pickup {
\(QueryObjects.pickup)
}
label
}
}
"""
/* works with variables as:
{
"input": {
"pickupId": "4" or 4
"confirmationCode: "CodeGoesHere"
}
}
*/
static let cancelPickup = """
mutation CancelPickup($input: CancelPickupInput) {
cancelPickup(input: $input) {
pickup {
\(QueryObjects.pickup)
}
}
}
"""
}
| 22.443299 | 64 | 0.477722 |
83ba743b322c541887033c26057deeaff1bfddc7 | 40,659 | db2 | SQL | sqlpl/modules.db2 | adrianmahjour/db2-samples | ff984aec81c5c08ce28443d896c0818cfae4f789 | [
"Apache-2.0"
] | 54 | 2019-08-02T13:15:07.000Z | 2022-03-21T17:36:48.000Z | sqlpl/modules.db2 | junsulee75/db2-samples | d9ee03101cad1f9167eebc1609b4151559124017 | [
"Apache-2.0"
] | 13 | 2019-07-26T13:51:16.000Z | 2022-03-25T21:43:52.000Z | sqlpl/modules.db2 | junsulee75/db2-samples | d9ee03101cad1f9167eebc1609b4151559124017 | [
"Apache-2.0"
] | 75 | 2019-07-20T04:53:24.000Z | 2022-03-23T20:56:55.000Z | -------------------------------------------------------------------------------
-- (c) Copyright IBM Corp. 2008 All rights reserved.
--
-- The following sample of source code ("Sample") is owned by International
-- Business Machines Corporation or one of its subsidiaries ("IBM") and is
-- copyrighted and licensed, not sold. You may use, copy, modify, and
-- distribute the Sample in any form without payment to IBM, for the purpose of
-- assisting you in the development of your applications.
--
-- The Sample code is provided to you on an "AS IS" basis, without warranty of
-- any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR
-- IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do
-- not allow for the exclusion or limitation of implied warranties, so the above
-- limitations or exclusions may not apply to you. IBM shall not be liable for
-- any damages you suffer as a result of using, copying, modifying or
-- distributing the Sample, even if IBM has been advised of the possibility of
-- such damages.
-------------------------------------------------------------------------------
--
-- SOURCE FILE NAME: modules.db2
--
-- SAMPLE: This sample demonstrates:
-- 1. Creation of modules and module objects
-- 2. Creation and usage of row data types, boolean data type,
-- associative arrays and array of rows
-- 3. Creation and usage of strongly-typed, weakly-typed and
-- parameterized cursors
-- 4. Full SQL PL support for functions, triggers and compiled
-- compound statements
-- 5. Support for INOUT and OUT parameters in compiled UDFs
-- 6. Support for compiled UDFs and triggers that contain
-- assignment to global variables
--
-- USAGE SCENARIO: This is a furniture store product purchasing scenario
-- in which data related to purchase orders, product delivery and inventory
-- is managed. Store customers can place a purchase order for a set of
-- furniture items and specify delivery requirements. A customer bill is
-- generated that reflects the order placed and the total order cost.
-- Shippping costs are determined and the shipping information is recorded.
-- A check is maintained on the stock of products in the store. Suppliers can
-- view data regarding supply requirements. A store bill is generated for the
-- stock replenished.
--
-- SAMPLE DESCRIPTION: The data is stored in tables:
--
-- (1) Product_details : Contains the details of products available in
-- the store.
-- (2) Customer_details : Contains the customer details.
-- (3) Purchaseorder_master : Contains details of the customer purchase order.
-- This is the master table.
-- (4) Purchaseorder_details : Contains details of products ordered by the
-- customer. This is the child table.
-- (5) Shipping : Contains details of products shipped to the
-- customers.
-- (6) Inventory_details : Contains details of products available with the
-- supplier.
-- (7) Supply_orders : Contains details of products that need to be
-- replenished in the store by the supplier.
--
-- The application processing is performed by the following routines:
--
-- (1) Function 'replenish_stock' : Procures details of products that need to
-- be replenished in the store to place an
-- order with the supplier.
-- (2) Trigger 'check_stock' : Checks stock of items remaining in the
-- store and places order with the supplier
-- (3) Module 'store_transactions' : Contains stored procedures, functions,
-- user-defined data types and cursors that
-- process all customer-store transactions.
-- This module is used by the store owner.
--
-- (a) Function 'compute_bill' : Computes the total amount payable for the
-- customer order.
-- (b) Procedure 'process_order' : Processes the customer-store transactions
-- and calls the 'compute_bill' function to
-- compute the customer bill.
-- (c) Procedure 'take_order' : Takes the customer order as input, inserts
-- it into the tables and generates the
-- customer bill.
-- (d) Procedure 'shipping' : Processes the shipping of products to the
-- customer.
--
-- (4) Module 'supply_stock' : Processes the supplier-store transactions.
-- This module is used by the supplier.
--
-- (a) Function 'compute_bill' : Computes the amount payable by the store
-- owner for each product supplied.
-- (b) Procedure 'process_order' : Processes the supplier-store transactions
-- and calls the function 'compute_bill'
-- to compute the store bill.
--
-- (5) Standalone Compiled Compound Statement :
-- Calls the 'take_order' and 'shipping' procedures of
-- the module 'store_transactions' to process the
-- customer-store transactions and the 'process_order'
-- procedure of the module 'supply_stock' to process the
-- supplier-store transactions.
-------------------------------------------------------------------------------
--
-- SQL STATEMENTS USED:
-- CREATE TABLE
-- CREATE TYPE
-- CREATE SEQUENCE
-- CREATE TRIGGER
-- CREATE VARIABLE
-- CREATE MODULE
-- ALTER MODULE PUBLISH TYPE
-- ALTER MODULE PUBLISH FUNCTION
-- ALTER MODULE PUBLISH PROCEDURE
-- ALTER MODULE ADD FUNCTION
-- ALTER MODULE ADD PROCEDURE
-- INSERT
-- SELECT
-- UPDATE
-- DROP MODULE
-- DROP TABLE
-- DROP TYPE
-- DROP SEQUENCE
-- DROP VARIABLE
-------------------------------------------------------------------------------
-- Connect to 'sample' database
CONNECT TO sample@
-----------------------------------------------------------------------------
-- 1. Create and populate the tables 'inventory_details', 'product_details',
-- 'customer_details', 'purchaseorder_master', 'purchaseorder_details',
-- 'shipping' and 'supply_orders'.
-----------------------------------------------------------------------------
-- Create table 'inventory_details' to store details of products available
-- with the supplier
CREATE TABLE inventory_details(
product_ID BIGINT NOT NULL,
quantity INTEGER,
location VARCHAR(20),
cost DECFLOAT,
PRIMARY KEY (product_ID))@
-- Insert existing values into the 'inventory_details' table
INSERT INTO inventory_details
VALUES(11, 50, 'warehouse', 80),
(12, 40, 'warehouse', 750),
(13, 35, 'store', 900),
(14, 25, 'warehouse', 2200),
(20, 60, 'store', 400),
(100, 55, 'warehouse', 10000),
(121, 25, 'warehouse', 8000)@
-- Create table 'product_details' to store details of the products available
-- in the store
CREATE TABLE product_details(
product_ID BIGINT NOT NULL,
product_name VARCHAR(10),
quantity_available INTEGER,
selling_price DECFLOAT,
PRIMARY KEY (product_ID),
CONSTRAINT fk_prodid2 FOREIGN KEY (product_ID)
REFERENCES inventory_details (product_ID) ON DELETE CASCADE)@
-- Insert existing product details into the 'product_details' table
INSERT INTO product_details
VALUES(11, 'VASE', 10, 100),
(12, 'CHAIR', 10, 900),
(13, 'TABLE', 6, 1100),
(14, 'BED', 4, 2500)@
-- Create table 'customer_details' to store the customer details
CREATE TABLE customer_details(
customer_ID BIGINT NOT NULL,
customer_name VARCHAR(15),
phoneno BIGINT,
address VARCHAR(50),
purchase_amount BIGINT,
PRIMARY KEY (customer_ID))@
-- Insert existing customer details into the 'customer_details' table
INSERT INTO customer_details
VALUES(1000, 'Bob', '9845245388', '104,Millers Street,Toronto', 6000),
(1001, 'Joe', '9876543012', '112,Fairview Lane,Ontario', 10000),
(1002, 'Pat', '9765909016', '15,Singer Street,Langsford', 4800),
(1003, 'Mat', '9890371322', '214,Hilton Street,Parksville', 5400)@
-- Tables 'purchaseorder_master' and 'purchaseorder_details' store the
-- customer order details. The master table 'purchaseorder_master' contains
-- details of the order such as the purchaseorder ID, order date, etc.
-- As a customer order may contain multiple products, a separate child table
-- 'purchaseorder_details' stores details of the products ordered.
-- Create table 'purchaseorder_master' to store details of the orders
-- placed by the customers
CREATE TABLE purchaseorder_master(
purchaseorder_ID BIGINT NOT NULL,
customer_ID BIGINT NOT NULL,
order_date DATE,
status VARCHAR(10) NOT NULL WITH DEFAULT 'UNSHIPPED',
total_amount DECFLOAT WITH DEFAULT 0,
PRIMARY KEY (purchaseorder_ID),
CONSTRAINT fk_custid FOREIGN KEY (customer_ID)
REFERENCES customer_details (customer_ID) ON DELETE RESTRICT)@
-- Create table 'purchaseorder_details' to store details of products ordered
-- by the customers
CREATE TABLE purchaseorder_details(
purchaseorder_master_ID BIGINT NOT NULL,
product_ID BIGINT NOT NULL,
quantity_ordered INTEGER,
CONSTRAINT fk_poid1 FOREIGN KEY (purchaseorder_master_ID)
REFERENCES purchaseorder_master (purchaseorder_ID) ON DELETE CASCADE,
CONSTRAINT fk_prodid3 FOREIGN KEY (product_ID)
REFERENCES product_details (product_ID) ON DELETE CASCADE)@
-- Insert existing orders into the 'purchaseorder_master' table
INSERT INTO purchaseorder_master
VALUES(10497, 1000, '2008-03-11', 'UNSHIPPED', 2500),
(10498, 1003, '2008-02-15', 'SHIPPED', 2500),
(10499, 1001, '2008-03-10', 'UNSHIPPED', 4200)@
-- Insert existing orders into the 'purchaseorder_details' table
INSERT INTO purchaseorder_details
VALUES(10497, 12, 2),
(10498, 14, 1),
(10499, 11, 4),
(10499, 12, 1)@
-- Create table 'shipping' to store details of customer orders for shipping
CREATE TABLE shipping(
purchaseorder_ID BIGINT NOT NULL,
customer_ID BIGINT NOT NULL,
customer_address VARCHAR(50),
order_date DATE,
shipping_date DATE,
shipping_cost BIGINT,
CONSTRAINT fk_poid2 FOREIGN KEY (purchaseorder_ID)
REFERENCES purchaseorder_master (purchaseorder_ID) ON DELETE CASCADE,
CONSTRAINT fk_custid2 FOREIGN KEY (customer_ID)
REFERENCES customer_details (customer_ID) ON DELETE RESTRICT)@
-- Insert existing shipping details into the 'shipping' table
INSERT INTO shipping
VALUES(10498,
1003,
'214,Hilton Street,Parksville',
'2008-02-15',
'2008-02-16',
50)@
-- Create table 'supply_orders' that stores details of products that
-- need to be supplied to the store by the supplier
CREATE TABLE supply_orders(
store_ID BIGINT NOT NULL,
product_ID BIGINT NOT NULL,
quantity_required INTEGER,
status VARCHAR(30) NOT NULL,
CONSTRAINT fk_prodid1 FOREIGN KEY (product_ID)
REFERENCES inventory_details (product_ID) ON DELETE CASCADE)@
-- Insert existing values into the 'supply_orders' table
INSERT INTO supply_orders
VALUES(1106009, 11, 5, 'STOCK REPLENISHED'),
(2204510, 14, 20, 'STOCK REPLENISHED'),
(1106009, 14, 10, 'PENDING')@
-----------------------------------------------------------------------------
-- 2. Create sequence, row data types and global variables
-----------------------------------------------------------------------------
-- Create a sequence to automatically generate purchase order IDs
CREATE OR REPLACE SEQUENCE purchaseorder_ID START WITH 10500@
-- Create an associative array type to store customer input values
CREATE TYPE assoc_array AS INTEGER ARRAY[INTEGER]@
-- Create row data types having the same fields as the columns in the
-- respective tables
CREATE TYPE order_stock_t AS ROW ANCHOR ROW OF supply_orders@
CREATE TYPE product_stock_t AS ROW
(product_ID BIGINT, product_name VARCHAR(10))@
-- Create global boolean and row type variables
CREATE OR REPLACE VARIABLE value_v BOOLEAN@
CREATE OR REPLACE VARIABLE product_stock_v product_stock_t@
-----------------------------------------------------------------------------
-- 3. Function 'replenish_stock' showcases :
-- - Row type variable as return type
-- - Usage of row type variable within a function
-- - Global variable support
-----------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION replenish_stock()
RETURNS order_stock_t
LANGUAGE SQL
BEGIN
----------------------------
-- Declaration Section
----------------------------
-- Local variable declaration of row type 'order_stock_t'
DECLARE order_stock_v order_stock_t;
----------------------------
-- Executable SQL Statements
----------------------------
-- Populate values into the row type variable
SET order_stock_v.store_ID = 1106009;
SET order_stock_v.product_ID = product_stock_v.product_ID;
SET order_stock_v.quantity_required = 10;
SET order_stock_v.status = 'PENDING';
-- Print the details of products that need to be replenished
-- Usage of global boolean variable 'value_v'
IF value_v = TRUE THEN
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('--------------------------------------------');
CALL DBMS_OUTPUT.PUT_LINE('REPLENISH STOCK FOR THE FOLLOWING PRODUCTS :');
CALL DBMS_OUTPUT.PUT_LINE('--------------------------------------------');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('***********************************************');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('PRODUCT ID'||' '||'PRODUCT NAME'||' ');
CALL DBMS_OUTPUT.PUT_LINE('----------'||' '||'------------'||' ');
END IF;
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT(product_stock_v.product_ID);
CALL DBMS_OUTPUT.PUT(' ');
CALL DBMS_OUTPUT.PUT(product_stock_v.product_name);
IF value_v = FALSE THEN
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('***********************************************');
CALL DBMS_OUTPUT.NEW_LINE;
END IF;
RETURN order_stock_v;
END@
-----------------------------------------------------------------------------
-- 4. Trigger 'check_stock' showcases :
-- - Full SQL PL support for Triggers
-- - Exit handler within a trigger
-- - Support for assignment to global variables
-----------------------------------------------------------------------------
CREATE OR REPLACE TRIGGER check_stock
AFTER UPDATE OF quantity_available ON product_details
REFERENCING NEW AS new
FOR EACH ROW
BEGIN
----------------------------
-- Declaration Section
----------------------------
-- Local variable declaration of row type 'order_stock_t'
DECLARE place_order_v order_stock_t;
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
DECLARE SQLCODE INTEGER DEFAULT 0;
DECLARE errorLabel CHAR(50) DEFAULT '';
-- Error Handler in case of SQL error
DECLARE EXIT HANDLER FOR SQLEXCEPTION
SIGNAL SQLSTATE VALUE sqlstate SET MESSAGE_TEXT = errorLabel;
----------------------------
-- Executable SQL Statements
----------------------------
-- Assignment to global row type variable 'product_stock_v'
IF new.quantity_available < 5 THEN
SET product_stock_v.product_ID = new.product_ID;
SET product_stock_v.product_name = new.product_name;
-- Call the function 'replenish_stock'
SET place_order_v = replenish_stock();
SET errorLabel = 'INSERT INTO supply_orders';
-- Populate the 'supply_orders' table with details of products that need
-- to be replenished
INSERT INTO supply_orders VALUES place_order_v;
END IF;
END@
-----------------------------------------------------------------------------
-- 5. Create module 'store_transactions'. The module showcases encapsulation
-- via Public and Private object visibility. It also showcases support for
-- procedures, functions, cursor types and row data type creation and
-- usage within the module
-----------------------------------------------------------------------------
echo --------------------------@
echo Start Module Specification@
echo --------------------------@
CREATE OR REPLACE MODULE store_transactions@
-- The objects specified in the module specification are visible outside the
-- module as they are defined with the 'PUBLISH' keyword
-- Create row data types having the same fields as the columns in the
-- respective tables
ALTER MODULE store_transactions PUBLISH TYPE product_t
AS ROW(product_ID BIGINT, product_name VARCHAR(10))@
ALTER MODULE store_transactions PUBLISH TYPE purchaseorder_master_t
AS ROW(purchaseorder_ID BIGINT,
customer_ID BIGINT,
order_date DATE,
status VARCHAR(10),
total_amount DECFLOAT)@
ALTER MODULE store_transactions PUBLISH TYPE purchaseorder_details_t
AS ROW ANCHOR ROW OF purchaseorder_details@
ALTER MODULE store_transactions PUBLISH TYPE customer_t
AS ROW ANCHOR ROW OF customer_details@
ALTER MODULE store_transactions PUBLISH TYPE stock_orders_t
AS ROW ANCHOR ROW OF supply_orders@
-- Create a type for collection of rows to store an array of row type variables
ALTER MODULE store_transactions PUBLISH TYPE purchaseorder_master_array_t
AS purchaseorder_master_t ARRAY[]@
-- Create Strong typed cursors that return a row of the corresponding row type
ALTER MODULE store_transactions
PUBLISH TYPE purchaseorder_master_cursor_t
AS purchaseorder_master_t CURSOR@
ALTER MODULE store_transactions
PUBLISH TYPE purchaseorder_details_cursor_t
AS purchaseorder_details_t CURSOR@
-- Create procedure prototypes
ALTER MODULE store_transactions
PUBLISH PROCEDURE take_order(customer_ID_p INTEGER,
productID_quantity_p assoc_array)@
ALTER MODULE store_transactions PUBLISH PROCEDURE shipping()@
echo ------------------------@
echo End Module Specification@
echo ------------------------@
echo ------------------------@
echo Body of Module@
echo ------------------------@
-----------------------------------------------------------------------------
-- 5.(a) Function 'compute_bill' (private module object) showcases :
-- - Full SQL PL support for functions
-- - Support for IN and OUT parameters
-- - Strong typed cursor as input parameter
-- - Cursor predicate 'IS NOT FOUND'
-- - Support for ANCHOR DATA TYPES
-- - Exit handler within a function
-- - Usage of row type variable
-----------------------------------------------------------------------------
ALTER MODULE store_transactions ADD FUNCTION compute_bill
(IN products_ordered_p purchaseorder_details_cursor_t,
OUT customer_bill_p DECFLOAT)
RETURNS INTEGER
LANGUAGE SQL
BEGIN
----------------------------
-- Declaration Section
----------------------------
-- Anchored scalar type in local variable declaration. This anchors the
-- datatype of the variable to that of the corresponding column in the table
DECLARE individual_cost_v ANCHOR DATA TYPE TO product_details.selling_price;
DECLARE purchase_products_v purchaseorder_details_t;
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
DECLARE code, SQLCODE INTEGER DEFAULT 0;
DECLARE errorLabel CHAR(50) DEFAULT '';
-- Error Handler in case of SQL error
DECLARE EXIT HANDLER FOR SQLEXCEPTION
SIGNAL SQLSTATE VALUE sqlstate SET MESSAGE_TEXT = errorLabel;
----------------------------
-- Executable SQL Statements
----------------------------
SET code = SQLCODE;
SET customer_bill_p = 0;
-- SQL statements to compute the amount payable for the customer purchase
-- with a discount of 10% offered if the total cost exceeds 5,000
fetch_loop:
LOOP
-- Fetch input cursor value into row type variable 'purchase_products_v'
FETCH products_ordered_p INTO purchase_products_v;
-- The cursor predicate 'IS NOT FOUND' checks whether a row has been
-- found for the cursor 'products_ordered_p'
IF products_ordered_p IS NOT FOUND
THEN LEAVE fetch_loop;
END IF;
SET errorLabel = 'SELECT selling_price';
SELECT selling_price
INTO individual_cost_v
FROM product_details
WHERE product_ID = purchase_products_v.product_ID;
SET customer_bill_p =
customer_bill_p + (individual_cost_v *
purchase_products_v.quantity_ordered);
END LOOP fetch_loop;
IF customer_bill_p > 5000
THEN SET customer_bill_p = 0.90 * customer_bill_p;
END IF;
CLOSE products_ordered_p;
RETURN code;
END@
-------------------------------------------------------------------------------
-- 5.(b) Procedure 'process_order' (private module object) showcases :
-- - Row type variable as an INOUT parameter
-- - Usage of row type variables within the procedure
-- - Strong typed cursor as OUT parameter
-- - Usage of strong and weak typed cursor within the procedure
-- - Passing of cursors between procedures and functions.
-------------------------------------------------------------------------------
ALTER MODULE store_transactions ADD PROCEDURE process_order
(INOUT purchaseorder_master_p purchaseorder_master_t,
OUT products_ordered purchaseorder_details_cursor_t)
LANGUAGE SQL
BEGIN
----------------------------
-- Declaration Section
----------------------------
DECLARE return_code_v INTEGER DEFAULT 0;
DECLARE customer_bill_v DECFLOAT;
----------------------------
-- Executable SQL Statements
----------------------------
-- Fetch details of products ordered using the strong typed cursor
-- 'products_ordered'
SET products_ordered = CURSOR FOR SELECT * FROM purchaseorder_details
WHERE purchaseorder_master_ID = purchaseorder_master_p.purchaseorder_ID;
OPEN products_ordered;
-- Call the function 'compute_bill' with the strong typed cursor
-- 'products_ordered' as IN parameter and the variable
-- 'customer_bill_v' to store the OUT parameter from the function
SET return_code_v = compute_bill(products_ordered, customer_bill_v);
SET purchaseorder_master_p.total_amount = customer_bill_v;
-- Update the 'purchaseorder_master' table with the total amount for
-- the transaction
UPDATE purchaseorder_master
SET total_amount = customer_bill_v
WHERE purchaseorder_ID = purchaseorder_master_p.purchaseorder_ID;
-- Update the 'customer_details' table with the total transaction
-- amount till date of each customer
UPDATE customer_details
SET purchase_amount = purchase_amount + customer_bill_v
WHERE customer_ID = purchaseorder_master_p.customer_ID;
-- Open the cursor again for the OUT parameter of the procedure
OPEN products_ordered;
END@
-----------------------------------------------------------------------------
-- 5.(c) Procedure 'take_order' (public module object) showcases :
-- - Anchored data type as IN parameter
-- - Usage of row type and boolean variables
-- - Associative array functionality
-- - Print using the DBMS_OUTPUT module routine
-----------------------------------------------------------------------------
ALTER MODULE store_transactions ADD PROCEDURE take_order
(IN customer_ID_p ANCHOR DATA TYPE TO purchaseorder_master.customer_ID,
IN productID_quantity_p assoc_array)
LANGUAGE SQL
BEGIN
----------------------------
-- Declaration Section
----------------------------
-- Local variable declaration of row data types
DECLARE purchaseorder_master_v purchaseorder_master_t;
DECLARE products_v purchaseorder_details_t;
-- Local declaration of strong typed cursor 'purchaseorder_details_cursor_t'
DECLARE products_cursor purchaseorder_details_cursor_t;
DECLARE count_v INTEGER DEFAULT 0;
DECLARE product_name_v VARCHAR(10);
----------------------------
-- Executable SQL Statements
----------------------------
-- Insert customer input into the 'purchaseorder_master' and
-- 'purchaseorder_details' table
SET purchaseorder_master_v.purchaseorder_ID = NEXT VALUE FOR purchaseorder_ID;
SET purchaseorder_master_v.customer_ID = customer_ID_p;
INSERT INTO purchaseorder_master
VALUES (purchaseorder_master_v.purchaseorder_ID,
purchaseorder_master_v.customer_ID,
CURRENT DATE,
DEFAULT,
DEFAULT);
-- Use the ARRAY_FIRST and ARRAY_NEXT functions to retrieve the first
-- and next index values respectively in the associative array
SET count_v = ARRAY_FIRST(productID_quantity_p);
-- Set a value for the global boolean variable
SET value_v = TRUE;
while (count_v IS NOT NULL) do
-- Populate the purchaseorder_ID, product_ID and quantity_ordered columns
-- of the 'purchaseorder_details' table and update the 'product_details'
-- table to reflect the reduction in stock in the store
INSERT INTO purchaseorder_details
VALUES(purchaseorder_master_v.purchaseorder_ID,
count_v,
productID_quantity_p[count_v]);
UPDATE product_details
SET quantity_available = quantity_available
- productID_quantity_p[count_v]
WHERE product_ID = count_v;
SET value_v = FALSE;
SET count_v = ARRAY_NEXT(productID_quantity_p, count_v);
END while;
-- Call procedure 'process_order' passing a row type variable as an
-- input parameter and a cursor variable to fetch the output parameter
CALL process_order
(purchaseorder_master_v, products_cursor);
-- Print the Customer Bill
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('-------------');
CALL DBMS_OUTPUT.PUT_LINE('CUSTOMER BILL');
CALL DBMS_OUTPUT.PUT_LINE('-------------');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('******************************************');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE
('TRANSACTION_ID : ' || purchaseorder_master_v.purchaseorder_ID);
CALL DBMS_OUTPUT.PUT_LINE('--------------');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT
('PRODUCT ID'||' '||'PRODUCT NAME'||' '||'QUANTITY ORDERED');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT
('----------'||' '||'------------'||' '||'----------------');
CALL DBMS_OUTPUT.NEW_LINE;
-- Fetch the output from the 'process_order' procedure using the
-- cursor 'products_cursor' into the row type variable 'products_v'
fetch_loop:
LOOP
FETCH products_cursor INTO products_v;
IF products_cursor IS NOT FOUND
THEN LEAVE fetch_loop;
END IF;
SELECT product_name
INTO product_name_v
FROM product_details
WHERE product_ID = products_v.product_ID;
-- Print the products ordered by the customer
CALL DBMS_OUTPUT.PUT(products_v.product_ID);
CALL DBMS_OUTPUT.PUT(' ');
CALL DBMS_OUTPUT.PUT(product_name_v);
CALL DBMS_OUTPUT.PUT(' ');
CALL DBMS_OUTPUT.PUT(products_v.quantity_ordered);
CALL DBMS_OUTPUT.NEW_LINE;
END LOOP fetch_loop;
CLOSE products_cursor;
-- Print the total bill payable by the customer
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('TOTAL : ' || purchaseorder_master_v.total_amount);
CALL DBMS_OUTPUT.PUT_LINE('-----');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('******************************************');
END@
-----------------------------------------------------------------------------
-- 5.(d) Procedure 'shipping' (public module object) showcases :
-- - Strong typed cursor functionality
-- - Array of rows (collection of row types) functionality
-----------------------------------------------------------------------------
ALTER MODULE store_transactions ADD PROCEDURE shipping()
LANGUAGE SQL
BEGIN
----------------------------
-- Declaration Section
----------------------------
DECLARE shipping_cost_v BIGINT DEFAULT 0;
DECLARE count_v INTEGER;
-- Local variable declaration of collection of rows type
-- 'purchaseorder_master_array_t'
DECLARE order_v purchaseorder_master_array_t;
-- Local variable declaration of row type 'customer_t'
DECLARE customer_v customer_t;
-- Local variable declaration of strong typed cursor
-- 'purchaseorder_master_cursor_t'
DECLARE order_details purchaseorder_master_cursor_t;
----------------------------
-- Executable SQL Statements
----------------------------
SET count_v = 1;
-- Strong typed cursor 'order_details' fetches details of 'UNSHIPPED'
-- transactions from the 'purchaseorder_master' table
SET order_details = CURSOR FOR SELECT * FROM purchaseorder_master
WHERE status = 'UNSHIPPED';
OPEN order_details;
fetch_loop:
LOOP
FETCH order_details INTO order_v[count_v];
IF order_details IS NOT FOUND
THEN LEAVE fetch_loop;
END IF;
-- The shipping cost is waived off for customers with
-- a purchase amount of over 8000
SELECT * INTO customer_v
FROM customer_details
WHERE customer_ID = order_v[count_v].customer_ID;
IF customer_v.purchase_amount > 8000
THEN SET shipping_cost_v = 0;
ELSE SET shipping_cost_v = 50;
END IF;
-- Populate the 'shipping' table with details of products shipped to
-- the customer
INSERT INTO shipping
VALUES (order_v[count_v].purchaseorder_ID,
customer_v.customer_ID,
customer_v.address,
order_v[count_v].order_date,
CURRENT DATE,
shipping_cost_v);
-- Update the order status in the 'purchaseorder_master' table
UPDATE purchaseorder_master
SET status = 'SHIPPED'
WHERE purchaseorder_ID = order_v[count_v].purchaseorder_ID;
SET count_v = count_v + 1;
END LOOP fetch_loop;
CLOSE order_details;
END@
echo ------------------------@
echo End Module Body@
echo ------------------------@
-----------------------------------------------------------------------------
-- 6. Create module 'supply_stock' used by the supplier.
-----------------------------------------------------------------------------
echo --------------------------@
echo Start Module Specification@
echo --------------------------@
CREATE OR REPLACE MODULE supply_stock@
-- Create a prototype of the procedure 'process_order'
ALTER MODULE supply_stock PUBLISH PROCEDURE process_order(store_ID_p BIGINT)@
echo ------------------------@
echo End Module Specification@
echo ------------------------@
echo ------------------------@
echo Body of Module@
echo ------------------------@
-----------------------------------------------------------------------------
-- 6.(a) Function 'compute_bill' (private module object) showcases :
-- - Support for IN and INOUT parameters
-- - Anchored data type variable as IN parameter
-----------------------------------------------------------------------------
ALTER MODULE supply_stock ADD FUNCTION compute_bill
(IN supply_product_p ANCHOR DATA TYPE TO ROW OF supply_orders,
INOUT store_bill_p DECFLOAT,
IN bulk_order_p INTEGER)
RETURNS INTEGER
LANGUAGE SQL
BEGIN
----------------------------
-- Declaration Section
----------------------------
DECLARE bill_v DECFLOAT DEFAULT 0;
DECLARE cost_price_v DECFLOAT DEFAULT 0;
DECLARE code INTEGER DEFAULT 0;
DECLARE SQLCODE INTEGER;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN
SET code = SQLCODE;
RETURN code;
END;
----------------------------
-- Executable SQL Statements
----------------------------
-- Procure the cost of each product from the 'inventory_details' table
SELECT cost
INTO cost_price_v
FROM inventory_details
WHERE product_ID = supply_product_p.product_ID;
-- Offer a discount to the store in case of bulk orders and compute the bill
IF bulk_order_p > 2
THEN SET bill_v = 0.80 * (cost_price_v * supply_product_p.quantity_required);
ELSE
SET bill_v = cost_price_v * supply_product_p.quantity_required;
END IF;
SET store_bill_p = store_bill_p + bill_v;
RETURN code;
END@
-----------------------------------------------------------------------------
-- 6.(b) Procedure 'process_order' (public module object) showcases :
-- - Weak typed and parameterized cursor functionality
-----------------------------------------------------------------------------
ALTER MODULE supply_stock ADD PROCEDURE process_order(IN store_ID_p BIGINT)
LANGUAGE SQL
BEGIN
----------------------------
-- Declaration Section
----------------------------
-- Local variable declaration of anchored data type
DECLARE supply_product_v ANCHOR DATA TYPE TO ROW OF supply_orders;
DECLARE return_code_v INTEGER DEFAULT 0;
DECLARE bulk_order_v INTEGER DEFAULT 0;
DECLARE store_bill_v DECFLOAT DEFAULT 0;
-- Declaration of weak typed cursor 'supply_pending'
DECLARE supply_pending CURSOR;
----------------------------
-- Executable SQL Statements
----------------------------
-- Print the Store Bill
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('-----------');
CALL DBMS_OUTPUT.PUT_LINE('STORE BILL');
CALL DBMS_OUTPUT.PUT_LINE('-----------');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('******************************************');
CALL DBMS_OUTPUT.PUT('STORE ID'||' '||'PRODUCT ID'||' ');
CALL DBMS_OUTPUT.PUT('QUANTITY SUPPLIED');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT('--------'||' '||'----------'||' ');
CALL DBMS_OUTPUT.PUT('-----------------');
CALL DBMS_OUTPUT.NEW_LINE;
-- Fetch the count of total number of orders placed by the store
SELECT count(*)
INTO bulk_order_v
FROM supply_orders
WHERE store_ID = store_ID_p;
-- Use 'parameterized cursor' to fetch the details of products that
-- need to be supplied to the store
SET supply_pending = CURSOR(store_ID_v BIGINT) FOR SELECT * FROM supply_orders
WHERE store_ID = store_ID_v AND status = 'PENDING';
OPEN supply_pending(store_ID_p);
fetch_loop:
LOOP
FETCH supply_pending INTO supply_product_v;
IF supply_pending IS NOT FOUND
THEN LEAVE fetch_loop;
END IF;
-- Update the 'inventory_details' table once the products are supplied
UPDATE inventory_details
SET quantity = quantity - (supply_product_v.quantity_required)
WHERE product_ID = supply_product_v.product_ID;
-- Call the function 'compute_bill' to compute the bill for the store.
-- 'store_bill_v' is an INOUT parameter to the function
SET return_code_v = compute_bill(supply_product_v, store_bill_v,
bulk_order_v);
-- Update the supply status in the 'supply_orders' table
UPDATE supply_orders
SET status = 'STOCK REPLENISHED'
WHERE store_ID = supply_product_v.store_ID
AND product_ID = supply_product_v.product_ID
AND status = 'PENDING';
-- Update the 'product_details' table to reflect the replenished stock
UPDATE product_details
SET quantity_available = quantity_available
+ supply_product_v.quantity_required
WHERE product_ID = supply_product_v.product_ID;
-- Print details of products supplied
CALL DBMS_OUTPUT.PUT(supply_product_v.store_ID);
CALL DBMS_OUTPUT.PUT(' ');
CALL DBMS_OUTPUT.PUT(supply_product_v.product_ID);
CALL DBMS_OUTPUT.PUT(' ');
CALL DBMS_OUTPUT.PUT(supply_product_v.quantity_required);
CALL DBMS_OUTPUT.NEW_LINE;
END LOOP fetch_loop;
CLOSE supply_pending;
-- Print the total bill payable to the supplier
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('TOTAL : ' || store_bill_v);
CALL DBMS_OUTPUT.PUT_LINE('-----');
CALL DBMS_OUTPUT.NEW_LINE;
CALL DBMS_OUTPUT.PUT_LINE('******************************************');
END@
echo ------------------------@
echo End Module Body@
echo ------------------------@
-----------------------------------------------------------------------------
-- 7. Standalone compiled compound statement showcases :
-- - Full SQL PL support for such blocks
-- - Associative array functionality
-- - Anchored data type functionality
-- - Exit handler within a compiled compound statement
-----------------------------------------------------------------------------
-- 'SET SERVEROUTPUT ON' to redirect the output to standard output
SET SERVEROUTPUT ON@
BEGIN
----------------------------
-- Declaration Section
----------------------------
-- Local variable declaration of associative array type
DECLARE productID_quantity_v assoc_array;
DECLARE customer_ID_v ANCHOR DATA TYPE TO purchaseorder_master.customer_ID;
DECLARE no_of_purchaseorders_v INTEGER;
DECLARE store_ID_v BIGINT;
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
DECLARE SQLCODE INTEGER DEFAULT 0;
DECLARE errorLabel CHAR(50) DEFAULT '';
-- Error Handler in case of SQL error
DECLARE EXIT HANDLER FOR SQLEXCEPTION
SIGNAL SQLSTATE VALUE sqlstate SET MESSAGE_TEXT = errorLabel;
----------------------------
-- Executable SQL Statements
----------------------------
-- Accept the customer input in an associative array
SET customer_ID_v = 1002;
SET productID_quantity_v[12] = 6;
SET productID_quantity_v[13] = 2;
---------------------------------------------------------------------------
-- Call the procedure 'store_transactions.take_order' to start the
-- customer-store transaction processing
---------------------------------------------------------------------------
-- Pass the associative array input to the 'take_order' procedure for further
-- processing
CALL store_transactions.take_order
(customer_ID_v, productID_quantity_v);
---------------------------------------------------------------------------
-- Call the 'store_transactions.shipping' procedure for product delivery
---------------------------------------------------------------------------
-- Fetch the count of number of 'UNSHIPPED' orders
SET errorLabel = 'SELECT COUNT';
SELECT count(*)
INTO no_of_purchaseorders_v
FROM purchaseorder_master
WHERE status = 'UNSHIPPED';
-- Call the 'shipping' procedure based on the number of unshipped orders
IF no_of_purchaseorders_v > 2
THEN CALL store_transactions.shipping();
END IF;
------------------------------------------------------------------------------
-- Call the procedure 'supply_stock.process_order' to start the supplier-store
-- transaction processing
------------------------------------------------------------------------------
SET store_ID_v = 1106009;
-- Use 2-part name to call the object 'process_order' common to both the modules
CALL supply_stock.process_order(store_ID_v);
END@
SET SERVEROUTPUT OFF@
------------------------------------------------
-- 8. Drop the tables and types created
------------------------------------------------
DROP TABLE purchaseorder_master@
DROP TABLE purchaseorder_details@
DROP TABLE customer_details@
DROP TABLE product_details@
DROP TABLE shipping@
DROP TABLE inventory_details@
DROP TABLE supply_orders@
DROP TYPE order_stock_t@
DROP TYPE product_stock_t@
DROP TYPE assoc_array@
| 37.404784 | 114 | 0.612952 |
76f5573972fa775b39e7ec75040944dc9f45ee97 | 717 | h | C | Move&Match Cards/MMOpenViewController.h | Sweeper777/MnM-v1-0-1 | 269d727660fe5fec88569e9c4f6af3c325cddfd9 | [
"MIT"
] | null | null | null | Move&Match Cards/MMOpenViewController.h | Sweeper777/MnM-v1-0-1 | 269d727660fe5fec88569e9c4f6af3c325cddfd9 | [
"MIT"
] | null | null | null | Move&Match Cards/MMOpenViewController.h | Sweeper777/MnM-v1-0-1 | 269d727660fe5fec88569e9c4f6af3c325cddfd9 | [
"MIT"
] | null | null | null | //
// MMOpenViewController.h
// Move&Match Cards
//
// Created by Mark Voskresenskiy on 27.06.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Defines.h"
@protocol MMOpenFileControllerDelegate;
@interface MMOpenViewController : UIViewController <UITableViewDataSource,UITableViewDelegate> {
IBOutlet UITableView *_table;
NSMutableArray *_filesArray;
NSMutableArray *_inboxArray;
}
@property (nonatomic,assign)id<MMOpenFileControllerDelegate>delegate;
-(void)loadingDocumentsArray;
@end
@protocol MMOpenFileControllerDelegate <NSObject>
-(void)openViewController:(MMOpenViewController*)controller didSelectDocument:(NSString*)docName;
@end | 23.129032 | 97 | 0.786611 |
e7e39a2a86b536954713b3f28000a8f6af0bcc84 | 7,353 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_865.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_865.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_865.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1b201, %rsi
lea addresses_WC_ht+0x19761, %rdi
nop
cmp $40576, %r11
mov $16, %rcx
rep movsw
nop
nop
nop
nop
nop
and $44924, %r9
lea addresses_normal_ht+0x1e766, %rsi
lea addresses_normal_ht+0x14da1, %rdi
clflush (%rdi)
nop
nop
inc %rax
mov $88, %rcx
rep movsq
nop
nop
nop
dec %rcx
lea addresses_WT_ht+0x1db89, %r11
inc %r14
mov (%r11), %ecx
nop
nop
dec %rax
lea addresses_D_ht+0x179a1, %rsi
lea addresses_A_ht+0x1b4e1, %rdi
nop
nop
nop
nop
nop
cmp $51218, %rax
mov $31, %rcx
rep movsb
nop
nop
sub %rsi, %rsi
lea addresses_WT_ht+0x19a1, %r14
cmp %rsi, %rsi
movb $0x61, (%r14)
sub $37925, %rdi
lea addresses_WT_ht+0x68c9, %r11
nop
nop
nop
cmp $8276, %rdi
movb $0x61, (%r11)
add %rcx, %rcx
lea addresses_UC_ht+0x2d83, %rsi
clflush (%rsi)
cmp %r11, %r11
mov $0x6162636465666768, %r9
movq %r9, %xmm6
vmovups %ymm6, (%rsi)
nop
nop
xor %rcx, %rcx
lea addresses_A_ht+0x102a1, %rax
clflush (%rax)
nop
nop
nop
add %rcx, %rcx
movb (%rax), %r11b
nop
and %rsi, %rsi
lea addresses_A_ht+0xdd01, %r9
nop
nop
inc %r14
mov $0x6162636465666768, %r11
movq %r11, (%r9)
nop
nop
nop
nop
nop
inc %r11
lea addresses_D_ht+0x135a1, %r11
sub $45725, %r9
mov (%r11), %rax
nop
nop
nop
nop
nop
inc %r14
lea addresses_WC_ht+0x119a1, %rsi
lea addresses_WC_ht+0x1e9a1, %rdi
nop
nop
nop
nop
add %r11, %r11
mov $120, %rcx
rep movsq
nop
nop
nop
nop
xor $56256, %r11
lea addresses_WC_ht+0xbda1, %r9
nop
nop
sub $28602, %r14
movw $0x6162, (%r9)
nop
cmp %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r8
push %r9
push %rbx
push %rdi
// Store
lea addresses_normal+0x19284, %r9
add %rdi, %rdi
movl $0x51525354, (%r9)
nop
inc %r12
// Load
lea addresses_UC+0x10d21, %r10
nop
nop
nop
xor $22131, %rbx
mov (%r10), %r8w
nop
nop
nop
nop
nop
sub $51450, %rbx
// Faulty Load
lea addresses_UC+0xf9a1, %rbx
nop
nop
nop
and %r13, %r13
movb (%rbx), %r10b
lea oracles, %r8
and $0xff, %r10
shlq $12, %r10
mov (%r8,%r10,1), %r10
pop %rdi
pop %rbx
pop %r9
pop %r8
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': True, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 10, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 7, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 35.350962 | 2,999 | 0.655515 |
cd9a148ce6868efad41f24b98d60c73834eb7d87 | 17,623 | sql | SQL | SQL/table_kehoachgiangday.sql | quocvan20301/vku_demo | 1c85b77a15b7e83308e7f0cbfa021f188718a4a0 | [
"MIT"
] | null | null | null | SQL/table_kehoachgiangday.sql | quocvan20301/vku_demo | 1c85b77a15b7e83308e7f0cbfa021f188718a4a0 | [
"MIT"
] | null | null | null | SQL/table_kehoachgiangday.sql | quocvan20301/vku_demo | 1c85b77a15b7e83308e7f0cbfa021f188718a4a0 | [
"MIT"
] | null | null | null | /*
Navicat Premium Data Transfer
Source Server : Mysql_DB
Source Server Type : MySQL
Source Server Version : 100417
Source Host : localhost:3306
Source Schema : demovku
Target Server Type : MySQL
Target Server Version : 100417
File Encoding : 65001
Date: 28/04/2021 09:20:46
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for table_kehoachgiangday
-- ----------------------------
DROP TABLE IF EXISTS `table_kehoachgiangday`;
CREATE TABLE `table_kehoachgiangday` (
`id` int NOT NULL AUTO_INCREMENT,
`noidung` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
`hoatdongdayhoc` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
`baidanhgia` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`cdrhocphan` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`id_hocphan` int NULL DEFAULT NULL,
`thuochocphan` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`namhoc` int NULL DEFAULT NULL,
`hocky` int NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 155 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of table_kehoachgiangday
-- ----------------------------
INSERT INTO `table_kehoachgiangday` VALUES (117, '1. Giới thiệu tổng quan_a. Giới thiệu về bảo mật_b. Các rủi ro_c. Lỗ hổng', 'Phương pháp giảng dạy:_-Giảng giải_-Chất vấn_Phương pháp học tập_-Quan sát và lắng nghe_-Hỏi và trả lời câu hỏi', 'A1.1_A2.1', '1', 85, 'lythuyet', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (118, '2. Xác thực, kiểm soát truy cập_a. Xác thực_b. Kiểm soát truy cập_c. Các giao thức mã hóa_d. Hạ tầng khóa công khai', 'Phương pháp giảng dạy:_-Giảng giải_-Chất vấn_Phương pháp học tập_-Quan sát và lắng nghe_-Hỏi và trả lời câu hỏi', 'A1.1_A2.1', '1_7_8', 85, 'lythuyet', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (119, '3. Bảo mật web_a. Tấn công trình duyệt_b. Khai thác dữ liệu người dùng và website_c. Tấn công email', 'Phương pháp giảng dạy:_-Giảng giải_-Chất vấn_Phương pháp học tập_-Quan sát và lắng nghe_-Hỏi và trả lời câu hỏi', 'A1.1_A2.1', '3_4_7', 85, 'lythuyet', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (120, 'Bài 1: Sử dụng lệnh trên Linux', 'Thực hành với một số lệnh căn bản trong Linux', 'A2.1', '3_4_7', 85, 'thuchanh', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (121, 'Bài 2: Sử dụng các công cụ cơ bản trong Metasploit', 'Áp dụng các lệnh đã học ở bài 1 và thực hành thêm 1 số lệnh đặc thù của Metasploit để sử dụng các công cụ cơ bản', 'A2.1', '3_4_7', 85, 'thuchanh', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (122, 'Bài 3: Thăm dò và thu thập thông tin đối tượng', 'Sử dụng Nmap, Metasploit, Kali và Wireshark để thu thập thông tin về mục tiêu', 'A2.1', '1_3_4_7', 85, 'thuchanh', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (123, 'Chương 1. Giới thiệu về hệ thống di động và tính toán di động_1.1. Giới thiệu_1.2. Mô hình tính toán di động_1.3. Mạng không dây và mạng di động_1.3.1 Hệ thống vệ tinh_1.3.2 Mạng Ad-hoc_1.3.3 Mạng cảm biến_1.3.4 Mạng WPAN, WLAN, WMAN', 'Giảng dạy lý thuyết;_Phát vấn;_Hỏi/đáp;_Làm bài tập', 'A1.1_A2.1_A4.1_A4.2', '1', 111, 'lythuyet', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (124, 'Chương 2. Giao thức truy cập trên thiết bị di động và không dây_2.1. Môi trường truyền không dây_2.2. Giới thiệu Ethernet MAC_2.3. Giao thức IEEE 802.11_2.5. Bluetooth and Zigbee (IEEE 802.15.4)_2.6. Lora và Mạng Lorawan_2.7. Mạng di động GSM, 2G, 3G, LTE-4G, 5G', 'Giảng dạy lý thuyết;_Phát vấn;_Hỏi/đáp;_Làm bài tập', 'A1.1_A2.1_A4.2', '1_2', 111, 'lythuyet', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (125, 'Bài thực hành 1: Lập trình điều khiển cảm biến trên Arduino và Raspberry', 'GV Hướng dẫn mẫu;_SV tự thực hiện', '', '', 111, 'thuchanh', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (126, 'Bài thực hành 2:_Thực hành Lora và LoraWan', 'GV Hướng dẫn mẫu;_SV tự thực hiện', 'A2.2', '4', 111, 'thuchanh', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (127, 'Bài thực hành 3:_Thực hành Mạng cảm biến Zigbee', 'GV Hướng dẫn mẫu;_SV tự thực hiện', 'A2.2', '4', 111, 'thuchanh', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (128, 'Chương 1. Tổng quan về xử lý ảnh_1.1 Khái niệm về ảnh số - xử lý ảnh_1.2 Lịch sử của xử lý ảnh_1.3 Ứng dụng xử lý ảnh số_1.4 Các bước cơ bản trong xử lý ảnh_1.5 Các thành phần trong hệ thống xử lý ảnh', 'Dạy: Trình bày bài giảng_Học ở lớp: Nghe và trao đổi_Tự học: Đọc trước bài giảng', 'A1.1_A2.1', '1_5', 91, 'lythuyet', 3, 1);
INSERT INTO `table_kehoachgiangday` VALUES (129, 'Chương 2. Cơ sở xử lý ảnh._2.1 Hệ thống thị giác của con người_2.2 Ánh sáng và quan phổ điện từ_2.3 Cảm biến và thu nhận ảnh_2.4 Số hóa ảnh - độ phân giải_2.5 Quan hệ cơ bản giữa các pixel_2.6 Một số công cụ toán học trong xử lý ảnh số', 'Dạy: Trình bày bài giảng_Học ở lớp: Nghe và trao đổi, làm bài tập_Tự học: Đọc trước bài giảng', 'A1.1_A2.1', '1_2_5', 91, 'lythuyet', 3, 1);
INSERT INTO `table_kehoachgiangday` VALUES (130, 'TH 1. Cài đặt OpenCV_- Cấu hình OpenCV_- Viết chương trình cơ bản sử dụng OpenCV và Python/C++_- Đọc và hiển thị ảnh_- Nộp bài trên hệ thống elearing', 'Dạy: Trình bày bài thực hành_Học ở lớp: Thực hành trên máy tính_Tự học: làm bài tập', 'A1.1_A2.1', '2_5', 91, 'thuchanh', 3, 1);
INSERT INTO `table_kehoachgiangday` VALUES (131, 'TH 2. Biến đổi cường độ điểm ảnh và Histogram_- Thay đổi độ sáng ảnh_- Thay đổi độ tương phản ảnh_- Tạo ảnh âm bản._- Biến đổi ảnh bằng hàm_-Biến đổi ảnh bằng hàm mũ(Gamma)_- Tính histogram của 1 ảnh_- Cân bằng histogram', 'Dạy: Trình bày bài bài thực hành_Học ở lớp: Thực hành trên máy tính_Tự học: làm bài tập', 'A1.1_A2.1', '2_3_4_5', 91, 'thuchanh', 3, 1);
INSERT INTO `table_kehoachgiangday` VALUES (132, 'Giới thiệu học phần_Chương 1. Tổng quan về hệ CSDL phân tán_1.1. Xử lý phân tán và hệ thống xử lý phân tán_1.1.1. Xử lý phân tán_1.1.2. Hệ thống phân tán 1.2. Hệ CSDL phân tán là gì 1.3. Sự cần thiết của hệ CSDL phân tán_1.4. Các đặc điểm của CSDL phân tán so với CSDL tập trung_1.5. Các mô hình cơ sở dữ liệu Client/Server_1.6. Mô hình cơ sở dữ liệu Server/Server_1.7. Mô hình tham chiếu CSDL phân tán_1.7.1. Lược đồ toàn cục 1.7.2. Lược đồ phân mảnh 1.7.3. Lược đồ cấp phát 1.7.4. Lược đồ ánh xạ cục bộ', 'Dạy:_- Giảng viên giới thiệu đến sinh viên mục tiêu môn học; vị trí và vai trò của môn học trong chương trình đào tạo của ngành; chuẩn đầu ra môn học, các hình thức kiểm tra đánh giá và trọng số của các bài đánh giá, nội dung học phần theo chương._- Giảng bài kết hợp trình chiếu slide bài giảng._- Đặt câu hỏi cho sinh viên suy nghĩ và trả lời._Học ở lớp:_- Nghe giảng._- Trả lời các câu hỏi của giảng viên đưa ra._- Đặt câu hỏi các vấn đề quan tâm._- Thảo luận: Chia nhóm thảo luận về các đặc trưng mạng máy tính_Học ở nhà:_- Ôn lại lý thuyết', 'A1.1', '1', 114, 'lythuyet', 3, 2);
INSERT INTO `table_kehoachgiangday` VALUES (133, 'Chương 1. Tổng quan về CSDL phân tán_1.8. Cấu trúc logic của CSDL phân tán._1.9. Lợi ích phân tán dữ liệu trên mạng_1.10. Hệ quản trị CSDL quan hệ_1.11. Tổng quan về hệ quản trị CSDL phân tán_1.11.1. Giới thiệu_1.11.2. Hệ quản trị CSDL phân tán thuần nhất_1.11.3. Hệ quản trị CSDL phân tán không thuần nhất 1.12. Mô hình kiến trúc hệ quản trị CSDL phân tán 1.13. Kiến trúc hệ quản trị CSDL phân tán', 'Dạy:_- Giảng bài kết hợp trình chiếu slide bài giảng._- Đặt câu hỏi/ bài tập cho sinh viên suy nghĩ và trả lời._Học ở lớp:_- Nghe giảng._- Suy nghĩ, thảo luận và trả lời các câu hỏi/ bài tập của giảng viên đưa ra._- Đặt câu hỏi các vấn đề quan tâm liên quan đến nội dung bài học._Học ở nhà:_- Ôn lại lý thuyết._- Làm bài tập về nhà', 'A1.1', '1_2_3_4_7', 114, 'lythuyet', 3, 2);
INSERT INTO `table_kehoachgiangday` VALUES (134, 'Chương 2. Thiết kế hệ CSDL phân tán_2.1. Các vấn đề về phân mảnh dữ liệu_2.1.1. Lý do phân mảnh 2.1.2. Các kiểu phân mảnh 2.1.3. Mức độ phân mảnh 2.1.4. Các quy tắc phân mảnh_2.1.5. Các kiểu cấp phát 2.1.6. Các yêu cầu thông tin 2.2. Phương pháp phân mảnh ngang_2.2.1. Khái niệm_2.2.2. Thông tin cần thiết của phân mảnh ngang_2.2.3. Phân mảnh ngang nguyên thủy_2.2.4. Tính đầy đủ và tính cực tiểu của vị từ đơn giản 2.2.5. Thuật toán xác định phân mảnh ngang nguyên thủy', 'Dạy:_- Giảng bài kết hợp trình chiếu slide bài giảng._- Đặt câu hỏi/ bài tập cho sinh viên suy nghĩ và trả lời._Học ở lớp:_- Nghe giảng._- Suy nghĩ, thảo luận và trả lời các câu hỏi/ bài tập của giảng viên đưa ra._- Đặt câu hỏi các vấn đề quan tâm liên quan đến nội dung bài học._Học ở nhà:_- Ôn lại lý thuyết._- Làm bài tập về nhà', 'A1.1', '1_2_3_4', 114, 'lythuyet', 3, 2);
INSERT INTO `table_kehoachgiangday` VALUES (135, 'Hướng dẫn cài đặt SQL Server phân tán', '- Giới thiệu về các hệ quản trị CSDL dùng trên phân tán và phiên bản dành cho database server._- Hướng dẫn cài đặt cấu hình kết nối từ các database server trong mạng LAN_- Hướng dẫn sinh viên thực hiện', 'A1.1', '2', 114, 'thuchanh', 3, 2);
INSERT INTO `table_kehoachgiangday` VALUES (136, 'BÀI THỰC HÀNH 1 (tt)', '- Giới thiệu LinkServer_- Hướng dẫn kết nối Link server_từ Access, SQL Server, Excel_- Theo dõi sinh viên làm bài', 'A1.1', '1', 114, 'thuchanh', 3, 2);
INSERT INTO `table_kehoachgiangday` VALUES (137, 'BÀI THỰC HÀNH 2:_Thiết kế phân tán Bài tập tình huống 1', '- Hướng dẫn thiết kế phân tán_- Hướng dẫn thực thi phân tán_trên mạng LAN_- Theo dõi sinh viên làm bài', 'A2.1', '6', 114, 'thuchanh', 3, 2);
INSERT INTO `table_kehoachgiangday` VALUES (138, 'Chương 1: Basic Ruby_1. Syntax_2. Array and Hashes_3. Loop_4. Blocks and Iterators_5. Class, Object and Mudules_6. Exceptions_7. Exercises', 'Phương pháp giảng dạy:_- Giảng viên giới thiệu đến sinh viên mục tiêu môn học; vị trí và vai trò của môn học trong chương trình đào tạo của ngành; chuẩn đầu ra môn học, các hình thức kiểm tra đánh giá và trọng số của các bài đánh giá, nội dung học phần theo chương._- Giảng bài kết hợp trình chiếu slide bài giảng._- Đặt câu hỏi cho sinh viên suy nghĩ và trả lời._Phương pháp học tập_- Nghe giảng._- Trả lời các câu hỏi của giảng viên đưa ra._- Đặt câu hỏi các vấn đề quan tâm._- Thảo luận: Chia nhóm thảo luận các vấn đề về ưu điểm và nhược điểm của các ngôn ngữ lập trình hướng đối tượng thông dụng hiện nay; Tại sao nên sử dụng ngôn ngữ lập trình Ruby và Ruby On Rails?', 'A1.1', '1_2', 47, 'lythuyet', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (139, 'Chương 2: Basic Ruby On Rails_1. Introduction_2. Setup_3. Active Records_4. Migrations_5. Controller_6. Routers_7. Views_8. Layouts_9. Scaffolding_10. Exercises', 'Phương pháp giảng dạy:_- Giảng bài kết hợp trình chiếu slide bài giảng._- Đặt câu hỏi cho sinh viên suy nghĩ và trả lời._Phương pháp học tập_- Nghe giảng._- Suy nghĩ, thảo luận và trả lời các câu hỏi của giảng viên đưa ra._- Đặt câu hỏi các vấn đề quan tâm liên quan đến nội dung bài học._- Thảo luận về hiệu quả của việc sử dụng Ruby On Rails', 'A1.1', '1', 47, 'lythuyet', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (140, 'Kiểm tra giữa kỳ', 'Kiểm tra giữa kỳ', 'A3.1', '1_2_3', 47, 'lythuyet', 2, 2);
INSERT INTO `table_kehoachgiangday` VALUES (141, 'Chương 1. Phần tử và hệ thống điều khiển tự động_1.1 Khái niệm điều khiển_1.2 Các nguyên tắc điều khiển_1.3 Phân loại điều khiển_1.4 Một số ví dụ về các hệ thống điều khiển', 'Đặt vấn đề_Thuyết trình__Lắng nghe_Làm bài tập', 'A1.1_A1.2', '1_2', 112, 'lythuyet', 3, 2);
INSERT INTO `table_kehoachgiangday` VALUES (142, 'Chương 2. Mô tả toán học hệ thống điều khiển liên tục_2.1 Khái niệm về mô hình toán học_2.2 Hàm truyền_2.3 Hàm truyền của hệ thống tự động_2.4 Phương trình trạng thái', 'Đặt vấn đề_Thuyết trình_Phát vấn__Lắng nghe_Làm bài tập', 'A1.1_A1.2', '1_2_3', 112, 'lythuyet', 3, 2);
INSERT INTO `table_kehoachgiangday` VALUES (143, 'Chương 3. Khảo sát tính ổn định của hệ thống_3.1 Khái niệm ổn định_3.2 Tiêu chuẩn ổn định đại số_3.3 Phương pháp quỹ đạo nghiệm số (QĐNS)_3.4 Tiêu chuẩn ổn định tần số', 'Đặt vấn đề_Thuyết trình__Lắng nghe_Làm bài tập', 'A1.1_A1.2', '1_2_3', 112, 'lythuyet', 3, 2);
INSERT INTO `table_kehoachgiangday` VALUES (144, 'Giới thiệu học phần_CHƯƠNG 1. TỔNG QUAN VỀ HỆ ĐIỀU HÀNH_1.1 Khái niệm hệ điều hành_1.2 Lịch sử hệ điều hành_1.3 Phần cứng máy tính_1.4 Phân loại hệ điều hành_1.5 Lời gọi hệ thống_1.6 Cấu trúc hệ điều hành', 'Dạy:_- Giảng bài kết hợp trình chiếu slide bài giảng._- Đặt câu hỏi cho sinh viên suy nghĩ và trả lời._- Hướng dẫn sinh viên làm bài tập._Học ở lớp:_- Nghe giảng._- Suy nghĩ, thảo luận và trả lời các câu hỏi của giảng viên đưa ra._- Đặt câu hỏi các vấn đề quan tâm liên quan đến nội dung bài học._- Làm bài tập._Học ở nhà:_- Ôn lại lý thuyết._- Làm bài tập về nhà.', 'A1.1_A2.1', '1', 21, 'lythuyet', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (145, 'CHƯƠNG 2. TIẾN TRÌNH VÀ TIỂU TRÌNH_2.1 Tiến trình_2.2 Tiểu trình_2.3 Giao tiếp liên tiến trình', 'Dạy:_- Giảng bài kết hợp trình chiếu slide bài giảng._- Đặt câu hỏi cho sinh viên suy nghĩ và trả lời._- Hướng dẫn sinh viên làm bài tập._Học ở lớp:_- Nghe giảng._- Suy nghĩ, thảo luận và trả lời các câu hỏi của giảng viên đưa ra._- Đặt câu hỏi các vấn đề quan tâm liên quan đến nội dung bài học._- Làm bài tập._Học ở nhà:_- Ôn lại lý thuyết._- Làm bài tập về nhà.', 'A1.1_A2.1', '2', 21, 'lythuyet', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (146, 'CHƯƠNG 2. TIẾN TRÌNH VÀ TIỂU TRÌNH (TT)_2.4 Điều phối tiến trình', 'Dạy:_- Giảng bài kết hợp trình chiếu slide bài giảng._- Đặt câu hỏi cho sinh viên suy nghĩ và trả lời._- Hướng dẫn sinh viên làm bài tập._Học ở lớp:_- Nghe giảng._- Suy nghĩ, thảo luận và trả lời các câu hỏi của giảng viên đưa ra._- Đặt câu hỏi các vấn đề quan tâm liên quan đến nội dung bài học._- Làm bài tập._Học ở nhà:_- Ôn lại lý thuyết._- Làm bài tập về nhà.', 'A1.1_A2.1', '2', 21, 'lythuyet', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (147, 'BÀI TẬP CHƯƠNG 1:_CÁC LỆNH CƠ BẢN TRÊN LINUX', '- Thực hành cài đặt máy ảo và hệ điều hành Linux._- Cấu hình cơ bản trên Linux.', 'A1.1_A2.1', '1', 21, 'thuchanh', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (148, 'BÀI TẬP CHƯƠNG 1: (TT)_CÁC LỆNH CƠ BẢN TRÊN LINUX', '- Sử dụng các lệnh cơ bản trên Linux.', 'A1.1_A2.1', '2', 21, 'thuchanh', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (149, 'CHƯƠNG 1. TỔNG QUAN VỀ KTMT_1.1. Các khái niệm cơ bản_1.1.1. Kiến trúc và tổ chức_1.1.2. Cấu trúc và chức năng_1.1.3. Lịch sử phát triển_1.2. Nguyên lý Von Neuman_1.3. Phân loại kiến trúc_1.4. Hiệu năng và luật Moore_1.5. Một số kiến trúc máy tính hiện đại_1.5.1. Kiến trúc x86 và x86-64_1.5.2. Kiến trúc UltraSparc', 'Dạy: Trình bày bài giảng Slide. Đặt câu hỏi cho sinh viên suy nghĩ và trả lời._Học ở lớp: Nghe, thảo luận và trao đổi._Tự học: Ôn lại lý thuyết. Đọc trước bài giảng, tham khảo thêm tài liệu.', 'A1.1_A2.1_A3.1', '1', 19, 'lythuyet', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (150, 'CHƯƠNG 2. CHỨC NĂNG MÁY TÍNH VÀ HỆ THỐNG BUS_2.1. Các thành phần chính của máy tính_2.1.1. CPU_2.1.2. Bộ nhớ_2.1.3. Thiết bị vào/ra_2.1.4. Hệ thống Bus_2.2. Chức năng của máy tính_2.2.1. Nạp và thực thi lệnh_2.2.2. Khái niệm ngắt_2.2.3. Lược đồ trạng thái chu trình lệnh_2.2.4. Chức năng vào/ra_2.3. Hệ thống Bus_2.3.1. Mô hình liên kết thành phần trong máy tính_2.3.2. Các kiểu truyền thông trong hệ thống liên kết_2.3.3. Lược đồ liên kết bus_2.3.4. Các đặc điểm của Bus', 'Dạy: Trình bày bài giảng Slide. Đặt câu hỏi cho sinh viên suy nghĩ và trả lời._Học ở lớp: Nghe, thảo luận và trao đổi._Tự học: Ôn lại lý thuyết. Đọc trước bài giảng, tham khảo thêm tài liệu', 'A1.1_A2.1_A3.1', '2_3_4_5', 19, 'lythuyet', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (151, 'CHƯƠNG 3. HỆ THỐNG BỘ NHỚ_3.1. Khái niệm và các đặc điểm của bộ nhớ_3.2. Phân cấp bộ nhớ_3.3. Bộ nhớ chính_3.3.1. Tổ chức_3.3.2. DRAM & SRAM_3.3.3. Một số kiểu ROM_3.3.4. DRAM hiệu năng cao SDRAM, DDR-SDRAM, Cache DRAM, …_3.3.5. Tổ chức bộ nhớ lớn', 'Dạy: Trình bày bài giảng Slide. Đặt câu hỏi cho sinh viên suy nghĩ và trả lời._Học ở lớp: Nghe, thảo luận và trao đổi._Tự học: Ôn lại lý thuyết. Đọc trước bài giảng, tham khảo thêm tài liệu.', 'A1.1_A2.1_A3.1', '2_3_4_5', 19, 'lythuyet', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (152, 'Bài thực hành 1:_Sử dụng phần mềm CPU-Z kiểm tra chi tiết các thành phần: CPU, RAM, DISK,... của máy tính', 'Dạy: Giảng viên giao và hướng dẫn bài thực hành._Học ở lớp: Sinh viên thực hành trên máy._Tự học: Sinh viên hoàn thành đầy đủ bài tập về nhà.', 'A1.1_A2.1_A3.1', '2_4_5', 19, 'thuchanh', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (153, 'Bài thực hành 2:_Assembly: Viết chương trình nhập vào các số nguyên dương và cộng dồn đến khi nào gặp một số âm thì kết thúc. Rồi in ra kết quả (Không cộng dồn số âm cuối vào).', 'Dạy: Giảng viên giao và hướng dẫn bài thực hành._Học ở lớp: Sinh viên thực hành trên máy._Tự học: Sinh viên hoàn thành đầy đủ bài tập về nhà.', 'A1.1_A3.1_A4.1', '1_3_4_5', 19, 'thuchanh', 1, 2);
INSERT INTO `table_kehoachgiangday` VALUES (154, 'Bài thực hành 3:_Kiểm tra cách máy tính thực hiện 1 chương trình (Sử dụng chương trình nguồn Assembly trong bài thực hành 2)._- Sử dụng phần mềm CPUSim xem cách CPU xử lý một chương trình._Các thông số mặc định của CPU và Main memory._+ CPU: Gồm các thanh ghi với số bít tương ứng_+ Xem kết quả và nhận xét', 'Dạy: Giảng viên giao và hướng dẫn bài thực hành. Hướng dẫn sử dụng phần mềm CPUSim và các phần mềm tương đương_Học ở lớp: Sinh viên thực hành trên máy._Tự học: Sinh viên hoàn thành đầy đủ bài tập về nhà.', 'A1.1_A2.1_A3.1', '2_3_4_5', 19, 'thuchanh', 1, 2);
SET FOREIGN_KEY_CHECKS = 1;
| 220.2875 | 1,141 | 0.722068 |
b55dff72018f511666b492c63d256ee2ebab5ab9 | 531 | sql | SQL | applications/piazza/queries.sql | pratikfegade/noria | 0460dd90ff8950cf1262bd66b58fd03620221b85 | [
"Apache-2.0",
"MIT"
] | 4,038 | 2018-10-04T19:09:24.000Z | 2022-03-31T06:38:35.000Z | noria-benchmarks/piazza/queries.sql | alanamarzoev/noria | ab5d51e6e88509748e75572a4068e344ea7ade92 | [
"Apache-2.0",
"MIT"
] | 81 | 2018-10-09T14:34:43.000Z | 2022-03-17T08:07:59.000Z | noria-benchmarks/piazza/queries.sql | alanamarzoev/noria | ab5d51e6e88509748e75572a4068e344ea7ade92 | [
"Apache-2.0",
"MIT"
] | 231 | 2018-10-05T21:53:11.000Z | 2022-03-27T15:01:22.000Z | posts: select * from Post where p_cid=?;
public_posts: select * from Post WHERE Post.p_private=0 and p_cid=?;
private_posts: select * from Post WHERE Post.p_private=1 and p_cid=?;
tas: select * from Role WHERE r_role = 1 and r_cid=?;
ta_posts: select * from Post WHERE Post.p_author in (select r_uid from Role WHERE Role.r_role=1) and p_cid=?;
enrolled_in: select r_cid from Role where r_uid=?;
enrolled_students: select r_uid from Role where r_cid=?;
-- vote_count: select postId, COUNT(userId) AS votes FROM Vote GROUP BY postId; | 66.375 | 109 | 0.760829 |
04707f21ca2ca4be7c6edf26b54fb8a550118549 | 1,065 | java | Java | cat-server/src/main/java/ch/basler/cat/mapper/DomainDtoMapper.java | baloise/cut | d38479b9957f680ea67b436c3395b255f16e4bb4 | [
"Apache-2.0"
] | 4 | 2019-10-14T09:41:50.000Z | 2020-09-28T08:19:25.000Z | cat-server/src/main/java/ch/basler/cat/mapper/DomainDtoMapper.java | baloise/cut | d38479b9957f680ea67b436c3395b255f16e4bb4 | [
"Apache-2.0"
] | 37 | 2019-10-25T20:20:34.000Z | 2022-02-19T00:13:43.000Z | cat-server/src/main/java/ch/basler/cat/mapper/DomainDtoMapper.java | baloise/cut | d38479b9957f680ea67b436c3395b255f16e4bb4 | [
"Apache-2.0"
] | null | null | null | package ch.basler.cat.mapper;
import ch.basler.cat.api.DomainDto;
import ch.basler.cat.model.Domain;
public class DomainDtoMapper extends DtoMapper<DomainDto, Domain> {
@Override
protected DomainDto entityToDto(Domain entity) {
DomainDto mapped = new DomainDto();
mapped.setId(entity.getId());
mapped.setPrefix(trim(entity.getPrefix()));
mapped.setProjectName(trim(entity.getProjectName()));
mapped.setPackageName(trim(entity.getPackageName()));
mapped.setEmail(trim(entity.getEmail()));
mapped.setCreator(trim(entity.getCreator()));
return mapped;
}
@Override
protected Domain dtoToEntity(DomainDto dto) {
Domain mapped = new Domain();
mapped.setId(dto.getId());
mapped.setPrefix(trim(dto.getPrefix()));
mapped.setProjectName(trim(dto.getProjectName()));
mapped.setPackageName(trim(dto.getPackageName()));
mapped.setEmail(trim(dto.getEmail()));
mapped.setCreator(trim(dto.getCreator()));
return mapped;
}
}
| 32.272727 | 67 | 0.667606 |
86074410357651aa5d107502eb2ad4a9056117bc | 583 | sql | SQL | database/mysql/src/main/resources/com/intel/mtwilson/database/mysql/20120328172743_create_0_5_1_schema_3.sql | opencit/dcg_security-mtwilson | 069bb5082becd0da7435675f569b46d2178b70ac | [
"BSD-3-Clause"
] | 45 | 2016-04-26T07:34:42.000Z | 2022-03-05T03:32:22.000Z | database/mysql/src/main/resources/com/intel/mtwilson/database/mysql/20120328172743_create_0_5_1_schema_3.sql | opencit/dcg_security-mtwilson | 069bb5082becd0da7435675f569b46d2178b70ac | [
"BSD-3-Clause"
] | 129 | 2016-06-07T20:26:23.000Z | 2022-02-27T07:21:22.000Z | database/mysql/src/main/resources/com/intel/mtwilson/database/mysql/20120328172743_create_0_5_1_schema_3.sql | opencit/dcg_security-mtwilson | 069bb5082becd0da7435675f569b46d2178b70ac | [
"BSD-3-Clause"
] | 29 | 2016-05-31T07:09:59.000Z | 2021-01-22T08:48:58.000Z |
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tbl_location_pcr` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`location` varchar(200) NOT NULL,
`pcr_value` varchar(100) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COMMENT='Mapping between the pcr values and location';
INSERT INTO `changelog` (`ID`, `APPLIED_AT`, `DESCRIPTION`) VALUES (20120328172743,NOW(),'premium - create 0.5.1 schema location pcr');
| 41.642857 | 135 | 0.728988 |
f095b62f054c9a8daeebfd1a5c74d88e84ac1994 | 2,023 | js | JavaScript | gulpconfig.js | darekkay/react-super-select | 94ba0e634db4e1587ba1ef799497093212fc8d0f | [
"MIT"
] | 104 | 2015-05-14T05:41:10.000Z | 2020-06-25T12:48:32.000Z | gulpconfig.js | darekkay/react-super-select | 94ba0e634db4e1587ba1ef799497093212fc8d0f | [
"MIT"
] | 92 | 2015-07-28T01:22:01.000Z | 2021-04-01T16:51:55.000Z | gulpconfig.js | darekkay/react-super-select | 94ba0e634db4e1587ba1ef799497093212fc8d0f | [
"MIT"
] | 45 | 2015-06-17T02:31:50.000Z | 2020-07-29T05:20:55.000Z | /*
* This file controls the behaviour of the build tasks in gulpfile.js
*/
var COMPONENT_NAME = 'react-super-select';
// Read the package.json to detect the package name and dependencies
var pkg = JSON.parse(require('fs').readFileSync('./package.json'));
module.exports = {
component: {
file: COMPONENT_NAME + '.js',
js: './src/react-super-select.js',
less: './src/react-super-select.less',
name: COMPONENT_NAME,
lib: 'lib',
src: 'src',
pkgName: pkg.name,
lint: {
js: [
'./src/**/*-spec.js',
'gulpfile.js'
],
less: [
'./src/react-super-select.less'
]
}
},
tasks: {
lint: {
js: [
'./tasks/*.js'
]
}
},
documentation: {
clean: [
'./src_docs/markdown/js/**/*',
'docs_generated/*'
],
docs_bundle: [
'./src_docs/index-bundle.js'
],
live_examples_bundle: [
'./src_docs/live-examples-app.js'
],
test_page_bundle: [
'./src_docs/test-page-app.js'
],
js_unbundled: [
'./src_docs/scale.fix.js',
],
css: [
'./lib/react-super-select.css',
'./src_docs/**/*.css',
'!./src_docs/stylesheets/docco.css'
],
less: {
files: './src/app.less',
dest: './src_docs/stylesheets'
},
css_vendor: ['./src_docs/stylesheets/docco.css'],
lint: {
js: [
'./src_docs/all-*.js'
]
},
markdown: {
files: ['./src_docs/markdown/**/*.md'],
dest: './src_docs/markdown/js'
},
fonts: {
files: 'src_docs/fonts/*',
dist: 'docs_generated/public/fonts'
},
img: {
files: 'src_docs/images/*',
dist: 'docs_generated/images'
},
example: {
dist: 'docs_generated',
files: [
'./src_docs/index.html',
'./src_docs/annotated-source.html',
'./src_docs/react-super-select-examples.html',
'./src_docs/test-page.html'
]
},
version_printer: './src_docs/version-printer.js'
}
};
| 21.072917 | 69 | 0.529412 |
8bb554dbfcb1d40cf4223a42ecdace5e9a4deddb | 202 | sql | SQL | src/test/resources/sql/select/72a55342.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 66 | 2018-06-15T11:34:03.000Z | 2022-03-16T09:24:49.000Z | src/test/resources/sql/select/72a55342.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 13 | 2019-03-19T11:56:28.000Z | 2020-08-05T04:20:50.000Z | src/test/resources/sql/select/72a55342.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 28 | 2019-01-05T19:59:02.000Z | 2022-03-24T11:55:50.000Z | -- file:oidjoins.sql ln:28 expect:true
SELECT ctid, aggmtransfn
FROM pg_catalog.pg_aggregate fk
WHERE aggmtransfn != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggmtransfn)
| 33.666667 | 78 | 0.792079 |
cb04ad5c09483e407ae9817cdbf64e948df7baab | 1,215 | h | C | deletedialog.h | memmaa/cock-heroine | e5da101c97e5a35447c32a9c46da5a4e657ea4b9 | [
"Artistic-2.0"
] | 7 | 2021-04-23T19:16:14.000Z | 2021-12-10T02:34:41.000Z | deletedialog.h | memmaa/cock-heroine | e5da101c97e5a35447c32a9c46da5a4e657ea4b9 | [
"Artistic-2.0"
] | null | null | null | deletedialog.h | memmaa/cock-heroine | e5da101c97e5a35447c32a9c46da5a4e657ea4b9 | [
"Artistic-2.0"
] | 1 | 2021-05-14T16:26:09.000Z | 2021-05-14T16:26:09.000Z | #ifndef DELETEDIALOG_H
#define DELETEDIALOG_H
#include <QDialog>
class EditorWindow;
#include <QShortcut>
namespace Ui {
class DeleteDialog;
}
class DeleteDialog : public QDialog
{
Q_OBJECT
public:
explicit DeleteDialog(EditorWindow *parent = nullptr);
~DeleteDialog();
virtual void accept() override;
private slots:
void on_deleteIntervalMergeWithFollowingRadioButton_toggled(bool checked);
void on_deleteIntervalMergeWithPreceedingRadioButton_toggled(bool checked);
void on_deleteIntervalMergePreceedingWithFollowingRadioButton_toggled(bool checked);
void on_deleteIntervalMoveLaterIntervalsRadioButton_toggled(bool checked);
void on_deleteIntervalMoveEarlierIntervalsRadioButton_toggled(bool checked);
private:
Ui::DeleteDialog *ui;
EditorWindow * editor;
void showEditorDeletePage();
void setLabels();
void setShortcuts();
void setButtonState();
QShortcut * mergeFollowingShortcut;
QShortcut * mergePrecedingShortcut;
QShortcut * mergeBothShortcut;
QShortcut * moveLaterShortcut;
QShortcut * moveEarlierShortcut;
QShortcut * doneShortcut;
};
#endif // DELETEDIALOG_H
| 24.795918 | 89 | 0.744856 |
b3d0ac8339febdcbddc0cee63181bbde4dc3e724 | 5,907 | kt | Kotlin | app/src/main/java/com/example/amolabs/lab3/Lab3Activity.kt | AlexPraefectus/AMOLabs | 17f99ca3910f94ef6235015fc3e357f0aa12aad1 | [
"BSD-3-Clause"
] | null | null | null | app/src/main/java/com/example/amolabs/lab3/Lab3Activity.kt | AlexPraefectus/AMOLabs | 17f99ca3910f94ef6235015fc3e357f0aa12aad1 | [
"BSD-3-Clause"
] | null | null | null | app/src/main/java/com/example/amolabs/lab3/Lab3Activity.kt | AlexPraefectus/AMOLabs | 17f99ca3910f94ef6235015fc3e357f0aa12aad1 | [
"BSD-3-Clause"
] | null | null | null | package com.example.amolabs.lab3
import android.graphics.Color
import android.os.Bundle
import android.support.v7.app.AlertDialog
import android.support.v7.app.AppCompatActivity;
import com.example.amolabs.R
import com.example.amolabs.lab3.interpolation.EyetkenInterpolator
import com.example.amolabs.lab3.interpolation.Interpolator
import com.example.amolabs.lab3.interpolation.LagrangeInterpolator
import com.example.amolabs.lab3.interpolation.NewtonInterpolator
import com.github.mikephil.charting.data.Entry
import com.github.mikephil.charting.data.LineData
import com.github.mikephil.charting.data.LineDataSet
import kotlinx.android.synthetic.main.activity_lab3.*
import kotlinx.android.synthetic.main.content_lab3.*
import java.lang.NumberFormatException
import kotlin.collections.ArrayList
import kotlin.math.cos
import kotlin.math.pow
import android.text.method.ScrollingMovementMethod
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet
/**
calculate function from the task
*/
fun taskFunction(x: Double): Double{
return cos(x + x.pow(cos(x)))
}
/**
* calculate base values (no interpolation, only formula)
* @param start x of first dot
* @param end x of last dot
* @param dotAmount amount of dots in base data
*/
fun getBaseVals(start: Double, end: Double, dotAmount: Int): ArrayList<Entry>{
val lst = ArrayList<Entry>()
var x:Double
var y:Double
for (i in 1..dotAmount){
x = start + (end - start) / dotAmount * i
y = taskFunction(x)
lst.add(Entry(x.toFloat(), y.toFloat()))
}
return lst
}
class Lab3Activity : AppCompatActivity() {
var baseEntries = ArrayList<Entry>()
var entries = ArrayList<Entry>()
private fun alertView(message: String) {
val builder = AlertDialog.Builder(this@Lab3Activity)
builder.setTitle("Повідомлення")
builder.setMessage(message)
builder.setPositiveButton("YES") { _, _ ->}
val dialog = builder.create()
dialog.show()
}
private fun entryListToString(arr: ArrayList<Entry>): String{
var res = "Значення:\n"
for (i: Entry in arr){
res += "(%.5f , %.5f)\n".format(i.x, i.y)
}
res += "\n\n\n"
return res
}
private fun drawBaseEntries(){
val dataSetCircleColors = ArrayList<Int>()
dataSetCircleColors.add(Color.BLUE)
val dataSet = LineDataSet(baseEntries, "Базові Значення") // add baseEntries to dataset
dataSet.color = Color.BLUE
dataSet.circleColors = dataSetCircleColors
val lineData = LineData(dataSet)
chart.data = lineData
textView11.text = entryListToString(baseEntries)
chart.invalidate()
}
private fun drawEntries(){
val datasets = ArrayList<ILineDataSet>()
val base = LineDataSet(baseEntries, "Базові Значення")
val baseCircleColors = ArrayList<Int>()
baseCircleColors.add(Color.BLUE)
base.color = Color.BLUE
base.circleColors = baseCircleColors
val new = LineDataSet(entries, "Значення з інтерполяцією")
val newCircleColors = ArrayList<Int>()
newCircleColors.add(Color.RED)
new.color = Color.RED
new.circleColors = newCircleColors
datasets.add(new)
datasets.add(base)
val data = LineData(datasets)
chart.data = data
textView11.text = entryListToString(entries)
chart.invalidate()
}
private fun configureChart(){
chart.isDragXEnabled = true
chart.isDragYEnabled = true
chart.isScaleYEnabled = false
chart.isScaleXEnabled = true
chart.description.text = "Графік функції"
}
private fun interpolate(){
if (baseEntries.isEmpty())return
var interpolator: Interpolator = LagrangeInterpolator()
var dotsInBetween = 2
try{
dotsInBetween = interpolation_steps.text.toString().toInt() + 1
}catch (e: NumberFormatException){
alertView("Некоректна кількість кроків інтерполяції, використано 1")
}
when(radio_group_lab3.checkedRadioButtonId){
lagrange.id -> {
interpolator = LagrangeInterpolator()
alertView("Інтерполяцію буде виконано методом Лагранжа")
}
newton.id -> {
interpolator = NewtonInterpolator()
alertView("Інтерполяцію буде виконано методом Ньютона")
}
}
val newEntries = ArrayList<Entry>(baseEntries.size * (dotsInBetween + 1) - 1)
for(i in 0 until baseEntries.size - 1){
newEntries.add(baseEntries[i])
for (j in 1..dotsInBetween){
newEntries.add(interpolator.interpolate(baseEntries, baseEntries[i].x + (baseEntries[i+1].x - baseEntries[i].x)/dotsInBetween*j))
}
}
newEntries.add(baseEntries[baseEntries.size-1])
entries = newEntries
drawEntries()
}
private fun drawBaseValues(){
try {
baseEntries = getBaseVals(
rangeStart.text.toString().toDouble(),
rangeEnd.text.toString().toDouble(),
dotAmount.text.toString().toInt())
}catch (e: NumberFormatException){
alertView("Некорректний формат введених номерів")
}
if (baseEntries.isEmpty()) return
drawBaseEntries()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_lab3)
setSupportActionBar(toolbar)
textView11.movementMethod = ScrollingMovementMethod()
lagrange.toggle() // lagrange interpolation is default method
configureChart()
base_vals_lab3.setOnClickListener {drawBaseValues()}
interpolate_lab3.setOnClickListener {interpolate()}
}
}
| 33.5625 | 145 | 0.65871 |
71426c6504ee61ab06fc21cd66a05df9cbc206db | 8,835 | ts | TypeScript | src/entities/sal-store-house-detail-log.ts | ehsanmandegar/kafka-agent | b5784b8962f446158d8aa7f835cfa95c757e3a97 | [
"MIT"
] | null | null | null | src/entities/sal-store-house-detail-log.ts | ehsanmandegar/kafka-agent | b5784b8962f446158d8aa7f835cfa95c757e3a97 | [
"MIT"
] | null | null | null | src/entities/sal-store-house-detail-log.ts | ehsanmandegar/kafka-agent | b5784b8962f446158d8aa7f835cfa95c757e3a97 | [
"MIT"
] | null | null | null | import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
@Index('PK_salStoreHouseDetailLog', ['pkfContractDetailLog'], { unique: true })
@Entity('salStoreHouseDetailLog', { schema: 'dbo' })
export class SalStoreHouseDetailLog {
@PrimaryGeneratedColumn({ type: 'int', name: 'pkfContractDetailLog' })
pkfContractDetailLog: number;
@Column('int', { name: 'typeLog' })
typeLog: number;
@Column('int', { name: 'FkfLogUser' })
fkfLogUser: number;
@Column('nchar', { name: 'logTime', length: 5, default: () => "''" })
logTime: string;
@Column('nchar', { name: 'logDate', length: 10, default: () => "''" })
logDate: string;
@Column('nvarchar', { name: 'computerIP', length: 255, default: () => "''" })
computerIp: string;
@Column('nvarchar', {
name: 'computerUser',
length: 255,
default: () => "''",
})
computerUser: string;
@Column('nvarchar', {
name: 'computerName',
length: 255,
default: () => "''",
})
computerName: string;
@Column('int', { name: 'pkfStoreHouse' })
pkfStoreHouse: number;
@Column('int', { name: 'serial' })
serial: number;
@Column('nvarchar', { name: 'storeHouseDate', length: 10 })
storeHouseDate: string;
@Column('int', { name: 'FkfStoreHouseType' })
fkfStoreHouseType: number;
@Column('nvarchar', { name: 'memo', length: 255 })
memo: string;
@Column('int', { name: 'FkfGeter', nullable: true })
fkfGeter: number | null;
@Column('nvarchar', { name: 'billOfLading', length: 100 })
billOfLading: string;
@Column('int', { name: 'FkfSource', nullable: true })
fkfSource: number | null;
@Column('nvarchar', { name: 'truckNO', length: 50 })
truckNo: string;
@Column('nvarchar', { name: 'createTime', length: 5 })
createTime: string;
@Column('nvarchar', { name: 'createDate', length: 10 })
createDate: string;
@Column('int', { name: 'accYear' })
accYear: number;
@Column('nvarchar', { name: 'address', length: 255 })
address: string;
@Column('nvarchar', { name: 'driverName', length: 255 })
driverName: string;
@Column('int', { name: 'FkfPorterage', nullable: true })
fkfPorterage: number | null;
@Column('int', { name: 'FkfStatus' })
fkfStatus: number;
@Column('int', { name: 'FkfProforma', nullable: true })
fkfProforma: number | null;
@Column('nvarchar', { name: 'getCondition', length: 255 })
getCondition: string;
@Column('int', { name: 'FkfTransfer', nullable: true })
fkfTransfer: number | null;
@Column('int', { name: 'FkfTypeStoreHouse', nullable: true })
fkfTypeStoreHouse: number | null;
@Column('int', { name: 'FkfTreaterMoein', nullable: true })
fkfTreaterMoein: number | null;
@Column('int', { name: 'FkfTreaterTafzili5', nullable: true })
fkfTreaterTafzili5: number | null;
@Column('int', { name: 'FkfTreaterTafzili6', nullable: true })
fkfTreaterTafzili6: number | null;
@Column('int', { name: 'sanadTempNo', nullable: true })
sanadTempNo: number | null;
@Column('bit', { name: 'sanad' })
sanad: boolean;
@Column('int', { name: 'FkfSanad', nullable: true })
fkfSanad: number | null;
@Column('int', { name: 'FkfContract', nullable: true })
fkfContract: number | null;
@Column('int', { name: 'FkfProject', nullable: true })
fkfProject: number | null;
@Column('int', { name: 'FkfMarkaz', nullable: true })
fkfMarkaz: number | null;
@Column('int', { name: 'FkfContractBuy', nullable: true })
fkfContractBuy: number | null;
@Column('int', { name: 'FkfProjectProduceBail', nullable: true })
fkfProjectProduceBail: number | null;
@Column('int', { name: 'serialStore' })
serialStore: number;
@Column('int', { name: 'FkfRequestGoodsDetail', nullable: true })
fkfRequestGoodsDetail: number | null;
@Column('int', { name: 'FkfProduce', nullable: true })
fkfProduce: number | null;
@Column('bit', { name: 'withOrigin' })
withOrigin: boolean;
@Column('bit', { name: 'isNumber' })
isNumber: boolean;
@Column('bit', { name: 'payOff' })
payOff: boolean;
@Column('bigint', { name: 'vat' })
vat: string;
@Column('int', { name: 'pkfStoreHouseDetail' })
pkfStoreHouseDetail: number;
@Column('int', { name: 'FkfGood' })
fkfGood: number;
@Column('decimal', { name: 'amountSource1', precision: 18, scale: 2 })
amountSource1: number;
@Column('decimal', { name: 'amountDestination1', precision: 18, scale: 2 })
amountDestination1: number;
@Column('decimal', { name: 'amountSource2', precision: 18, scale: 2 })
amountSource2: number;
@Column('decimal', { name: 'amountDestination2', precision: 18, scale: 2 })
amountDestination2: number;
@Column('decimal', { name: 'amountOrder1', precision: 18, scale: 2 })
amountOrder1: number;
@Column('decimal', { name: 'amountOrder2', precision: 18, scale: 2 })
amountOrder2: number;
@Column('int', { name: 'FKFGoodType', nullable: true })
fkfGoodType: number | null;
@Column('nvarchar', { name: 'memoDetail', length: 255 })
memoDetail: string;
@Column('int', { name: 'FKFStore' })
fkfStore: number;
@Column('decimal', { name: 'amountFinal1', precision: 18, scale: 2 })
amountFinal1: number;
@Column('decimal', { name: 'amountFinal2', precision: 18, scale: 2 })
amountFinal2: number;
@Column('int', { name: 'FkfPerformaDetail', nullable: true })
fkfPerformaDetail: number | null;
@Column('float', { name: 'fee', precision: 53 })
fee: number;
@Column('float', { name: 'buyFee', precision: 53 })
buyFee: number;
@Column('nvarchar', { name: 'tracing', length: 100 })
tracing: string;
@Column('int', { name: 'FkfTransferDetail', nullable: true })
fkfTransferDetail: number | null;
@Column('decimal', { name: 'difAmount', precision: 18, scale: 3 })
difAmount: number;
@Column('bigint', { name: 'priceWageRates' })
priceWageRates: string;
@Column('decimal', { name: 'amountWastePercent', precision: 18, scale: 3 })
amountWastePercent: number;
@Column('int', { name: 'idAddress' })
idAddress: number;
@Column('nvarchar', { name: 'outPutNo', length: 100 })
outPutNo: string;
@Column('nvarchar', { name: 'orderNo', length: 50 })
orderNo: string;
@Column('int', { name: 'point', nullable: true })
point: number | null;
@Column('int', { name: 'logC', nullable: true })
logC: number | null;
@Column('bigint', { name: 'virtualKaredex' })
virtualKaredex: string;
@Column('int', { name: 'FkfProduceDetail', nullable: true })
fkfProduceDetail: number | null;
@Column('int', { name: 'FkfImporttingExport', nullable: true })
fkfImporttingExport: number | null;
@Column('bit', { name: 'buildKardex' })
buildKardex: boolean;
@Column('int', { name: 'FkfImportDetail', nullable: true })
fkfImportDetail: number | null;
@Column('int', { name: 'FkfWeight', nullable: true })
fkfWeight: number | null;
@Column('nvarchar', { name: 'storeHouseType', length: 100 })
storeHouseType: string;
@Column('nvarchar', { name: 'geterCode', nullable: true, length: 50 })
geterCode: string | null;
@Column('nvarchar', { name: 'geterName', nullable: true, length: 100 })
geterName: string | null;
@Column('nvarchar', { name: 'sourceCode', nullable: true, length: 50 })
sourceCode: string | null;
@Column('nvarchar', { name: 'source', nullable: true, length: 150 })
source: string | null;
@Column('int', { name: 'FkfCreateUser' })
fkfCreateUser: number;
@Column('nvarchar', { name: 'createUser', nullable: true, length: 401 })
createUser: string | null;
@Column('int', { name: 'porterageCode', nullable: true })
porterageCode: number | null;
@Column('nvarchar', { name: 'porterage', nullable: true, length: 50 })
porterage: string | null;
@Column('nvarchar', { name: 'tafzili2Code', nullable: true, length: 50 })
tafzili2Code: string | null;
@Column('nvarchar', { name: 'tafzili2', nullable: true, length: 250 })
tafzili2: string | null;
@Column('nvarchar', { name: 'projectCode', nullable: true, length: 50 })
projectCode: string | null;
@Column('nvarchar', { name: 'project', length: 250 })
project: string;
@Column('nvarchar', { name: 'markazCode', nullable: true, length: 50 })
markazCode: string | null;
@Column('nvarchar', { name: 'markaz', nullable: true, length: 100 })
markaz: string | null;
@Column('nvarchar', { name: 'goodCode', length: 25 })
goodCode: string;
@Column('nvarchar', { name: 'goodName', length: 250 })
goodName: string;
@Column('nvarchar', { name: 'storeCode', length: 25 })
storeCode: string;
@Column('nvarchar', { name: 'storeName', length: 150 })
storeName: string;
@Column('nvarchar', { name: 'goodType', nullable: true, length: 250 })
goodType: string | null;
@Column('nvarchar', { name: 'typeStoreHouse', nullable: true, length: 250 })
typeStoreHouse: string | null;
}
| 28.40836 | 79 | 0.642332 |
62014bcd2281d2183c4ae92c2f26e01e90c25452 | 245 | dart | Dart | example/dialog.dart | SpinlockLabs/mac.dart | 4b178f1bfceee5804c638d7e1371517960112732 | [
"MIT"
] | 6 | 2020-01-02T10:41:19.000Z | 2021-11-28T14:17:05.000Z | example/dialog.dart | DirectMyFile/macOS.dart | 4b178f1bfceee5804c638d7e1371517960112732 | [
"MIT"
] | 2 | 2019-03-18T17:52:15.000Z | 2019-07-07T19:33:48.000Z | example/dialog.dart | DirectMyFile/macOS.dart | 4b178f1bfceee5804c638d7e1371517960112732 | [
"MIT"
] | 1 | 2019-07-04T05:19:36.000Z | 2019-07-04T05:19:36.000Z | import "package:mac/mac.dart";
main() async {
var result = await UI.displayDialog("Hello World", buttons: [
"Ok",
"Not Ok"
]);
if (result.button == "Ok") {
say("You said Ok.");
} else {
say("You didn't say Ok.");
}
}
| 16.333333 | 63 | 0.542857 |
8592a4dd3feef8b3b802619e5efe6c0356450b1c | 702 | js | JavaScript | jest.config.js | fillika/timesUp | 4c3014c86f58805348d2206b5fe946a9322c85fd | [
"MIT"
] | null | null | null | jest.config.js | fillika/timesUp | 4c3014c86f58805348d2206b5fe946a9322c85fd | [
"MIT"
] | null | null | null | jest.config.js | fillika/timesUp | 4c3014c86f58805348d2206b5fe946a9322c85fd | [
"MIT"
] | null | null | null | module.exports = {
roots: ["<rootDir>/src/tests/"], // Paths, where we can find our tests
transform: {
'^.+\\.tsx?$': 'ts-jest',
"\\.[jt]sx?$": "babel-jest"
},
moduleNameMapper: {
"^Scripts(.*)$": "<rootDir>/src/scripts$1",
},
testRegex: '(/__test__/.*|(\\.|/)(test|spec))\\.[jt]sx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
verbose: true, // for more info about our test's results
collectCoverage: true, // Grapfic for console + create dir coverage with statement
collectCoverageFrom: [
'<rootDir>/src/scripts/**/*.ts',
'<rootDir>/src/scripts/**/*.tsx',
'<rootDir>/src/scripts/**/*.js',
'<rootDir>/src/scripts/**/*.jsx',
]
} | 35.1 | 84 | 0.575499 |
902d0850b1d41bba69db83520ef2094722b541b0 | 849 | kt | Kotlin | app/src/main/java/me/shikhov/setupwizardapp/MainActivity.kt | andrey-shikhov/SetupWizard | 72b2cbc6630f91879b8aabfd08072da2ac0b7fb3 | [
"Apache-2.0"
] | 1 | 2021-11-07T21:46:35.000Z | 2021-11-07T21:46:35.000Z | app/src/main/java/me/shikhov/setupwizardapp/MainActivity.kt | andrey-shikhov/SetupWizard | 72b2cbc6630f91879b8aabfd08072da2ac0b7fb3 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/me/shikhov/setupwizardapp/MainActivity.kt | andrey-shikhov/SetupWizard | 72b2cbc6630f91879b8aabfd08072da2ac0b7fb3 | [
"Apache-2.0"
] | null | null | null | package me.shikhov.setupwizardapp
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import me.shikhov.wlog.Log
private const val TAG = "wizard-activity"
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.get(TAG).a("onCreate").r()
setContentView(R.layout.activity_main)
supportFragmentManager.beginTransaction()
.add(R.id.activity_root, SetupFragment())
.commit()
}
override fun onResume() {
super.onResume()
Log.get(TAG).a("onResume").r()
}
override fun onPause() {
super.onPause()
Log.get(TAG).a("onPause").r()
}
override fun onDestroy() {
super.onDestroy()
Log.get(TAG).a("onDestroy").r()
}
}
| 22.342105 | 56 | 0.633687 |
2a441ae049b2d40b53fcc6caa4c751aa7a95c985 | 3,375 | java | Java | app/src/main/java/com/shawn_duan/mynews/responses/Result.java | ShawnDuan/MyNews | 95cc2d6d69d968fbb9224ab6875b507315f9ec4c | [
"Apache-2.0"
] | 1 | 2016-10-25T00:34:19.000Z | 2016-10-25T00:34:19.000Z | app/src/main/java/com/shawn_duan/mynews/responses/Result.java | ShawnDuan/MyNews | 95cc2d6d69d968fbb9224ab6875b507315f9ec4c | [
"Apache-2.0"
] | 1 | 2016-10-24T08:11:36.000Z | 2016-10-24T08:11:36.000Z | app/src/main/java/com/shawn_duan/mynews/responses/Result.java | ShawnDuan/MyNews | 95cc2d6d69d968fbb9224ab6875b507315f9ec4c | [
"Apache-2.0"
] | null | null | null | package com.shawn_duan.mynews.responses;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Result {
@SerializedName("url")
@Expose
private String url;
@SerializedName("column")
@Expose
private String column;
@SerializedName("section")
@Expose
private String section;
@SerializedName("byline")
@Expose
private String byline;
@SerializedName("title")
@Expose
private String title;
@SerializedName("abstract")
@Expose
private String _abstract;
@SerializedName("published_date")
@Expose
private String publishedDate;
@SerializedName("source")
@Expose
private String source;
@SerializedName("media")
@Expose
private List<Medium> media = new ArrayList<Medium>();
/**
*
* @return
* The url
*/
public String getUrl() {
return url;
}
/**
*
* @param url
* The url
*/
public void setUrl(String url) {
this.url = url;
}
/**
*
* @return
* The column
*/
public String getColumn() {
return column;
}
/**
*
* @param column
* The column
*/
public void setColumn(String column) {
this.column = column;
}
/**
*
* @return
* The section
*/
public String getSection() {
return section;
}
/**
*
* @param section
* The section
*/
public void setSection(String section) {
this.section = section;
}
/**
*
* @return
* The byline
*/
public String getByline() {
return byline;
}
/**
*
* @param byline
* The byline
*/
public void setByline(String byline) {
this.byline = byline;
}
/**
*
* @return
* The title
*/
public String getTitle() {
return title;
}
/**
*
* @param title
* The title
*/
public void setTitle(String title) {
this.title = title;
}
/**
*
* @return
* The _abstract
*/
public String getAbstract() {
return _abstract;
}
/**
*
* @param _abstract
* The abstract
*/
public void setAbstract(String _abstract) {
this._abstract = _abstract;
}
/**
*
* @return
* The publishedDate
*/
public String getPublishedDate() {
return publishedDate;
}
/**
*
* @param publishedDate
* The published_date
*/
public void setPublishedDate(String publishedDate) {
this.publishedDate = publishedDate;
}
/**
*
* @return
* The source
*/
public String getSource() {
return source;
}
/**
*
* @param source
* The source
*/
public void setSource(String source) {
this.source = source;
}
/**
*
* @return
* The media
*/
public List<Medium> getMedia() {
return media;
}
/**
*
* @param media
* The media
*/
public void setMedia(List<Medium> media) {
this.media = media;
}
}
| 16.625616 | 57 | 0.505778 |
669fb3272c9b726824f3d701e6418d649cc907f5 | 432 | swift | Swift | Sources/BlowMindStyle/DefaultStyleEnvironmentConvertible.swift | BlowMindStyle/BlowMindStyle | 030809892046e5a28e7e50d67876476602374771 | [
"MIT"
] | 2 | 2019-07-14T19:28:31.000Z | 2019-08-07T12:55:51.000Z | Sources/BlowMindStyle/DefaultStyleEnvironmentConvertible.swift | BlowMindStyle/BlowMindStyle | 030809892046e5a28e7e50d67876476602374771 | [
"MIT"
] | null | null | null | Sources/BlowMindStyle/DefaultStyleEnvironmentConvertible.swift | BlowMindStyle/BlowMindStyle | 030809892046e5a28e7e50d67876476602374771 | [
"MIT"
] | 1 | 2020-03-31T09:48:40.000Z | 2020-03-31T09:48:40.000Z | import UIKit
/**
default implementation of `StyleEnvironmentConvertible`.
Uses NoTheme() and Locale.current
*/
public struct DefaultStyleEnvironmentConvertible: StyleEnvironmentConvertible {
public init() { }
public func toStyleEnvironment(_ traitCollection: UITraitCollection) -> StyleEnvironment<NoTheme> {
StyleEnvironment(traitCollection: traitCollection, theme: NoTheme(), locale: Locale.current)
}
}
| 28.8 | 103 | 0.768519 |
393a272e6096c3713de135381028d298ec87e88c | 668 | html | HTML | manuscript/page-1166/body.html | marvindanig/ramayana-vol-1 | b5cc2f0cd51936dab826107e7d1b337909172686 | [
"BlueOak-1.0.0",
"MIT"
] | null | null | null | manuscript/page-1166/body.html | marvindanig/ramayana-vol-1 | b5cc2f0cd51936dab826107e7d1b337909172686 | [
"BlueOak-1.0.0",
"MIT"
] | null | null | null | manuscript/page-1166/body.html | marvindanig/ramayana-vol-1 | b5cc2f0cd51936dab826107e7d1b337909172686 | [
"BlueOak-1.0.0",
"MIT"
] | null | null | null | <div class="leaf "><div class="inner justify"><pre class="no-indent ">drew,
A wood of Sal trees charmed the view;
That passed, the sun began to rise,
And Bharat saw with happy eyes,
Ayodhyá's city, built and planned
By ancient Manu's royal hand.
Seven nights upon the road had passed,
And when he saw the town at last
Before him in her beauty spread,
Thus Bharat to the driver said:
“This glorious city from afar,
Wherein pure groves and gardens are,
Seems to my eager eyes to-day
A lifeless pile of yellow clay.
Through all her streets where erst a throng
Of men and women streamed along,
Uprose the multitudinous roar:
To-day I hear that sound no</pre></div> </div> | 37.111111 | 76 | 0.763473 |
883fa5d82bc5cba80b816fa04afac0795a245d22 | 364 | sql | SQL | sql/updates/0.10/5030_mangos_item_template.sql | Ambal/mangos | 9833ce4e393ca36668751dbcc9dfcf7cae8ff4ff | [
"OpenSSL"
] | 1 | 2019-01-19T06:35:40.000Z | 2019-01-19T06:35:40.000Z | sql/updates/0.10/5030_mangos_item_template.sql | mfooo/wow | 3e5fad4cfdf0fd1c0a2fd7c9844e6f140a1bb32d | [
"OpenSSL"
] | null | null | null | sql/updates/0.10/5030_mangos_item_template.sql | mfooo/wow | 3e5fad4cfdf0fd1c0a2fd7c9844e6f140a1bb32d | [
"OpenSSL"
] | null | null | null | ALTER TABLE `item_template` CHANGE `AllowableClass` `AllowableClass` mediumint(9) not null default '-1';
ALTER TABLE `item_template` CHANGE `AllowableRace` `AllowableRace` mediumint(9) not null default '-1';
UPDATE `item_template` SET `AllowableClass` = -1 WHERE `AllowableClass` = 0;
UPDATE `item_template` SET `AllowableRace` = -1 WHERE `AllowableRace` = 0;
| 60.666667 | 104 | 0.752747 |
5dc9316b6359391d3c501b0a538e5d11f839cad9 | 291 | go | Go | cmd/mocqlient/mocqlient.go | koron/go-mqtt | b3f23029fa9f746a0d7ffb668cf475e8af12a1e0 | [
"MIT"
] | 7 | 2018-04-27T15:08:07.000Z | 2020-04-20T05:47:56.000Z | cmd/mocqlient/mocqlient.go | koron/go-mqtt | b3f23029fa9f746a0d7ffb668cf475e8af12a1e0 | [
"MIT"
] | 1 | 2016-02-12T09:05:11.000Z | 2016-02-15T08:20:46.000Z | cmd/mocqlient/mocqlient.go | koron/go-mqtt | b3f23029fa9f746a0d7ffb668cf475e8af12a1e0 | [
"MIT"
] | 4 | 2018-02-11T18:18:26.000Z | 2020-04-06T16:45:28.000Z | package main
func main() {
// TODO: write a client with go-mqtt/client, it should do...
// 1. connect to MQTT server
// 2. subscribe "#" topic.
// 3. publish a message "Hi MQTT Server" to "a/b/c/response" topic
// 4. log messages on each phases
done := make(chan struct{})
<-done
}
| 22.384615 | 67 | 0.646048 |
4790a9bcb91c6f22160be93772cf19a90eaed287 | 505 | html | HTML | _includes/fp-post-content.html | mitchchn/mitchchn.github.io | 3ad9aeb39dcc08c18b4ad7dde0a2f25d511489af | [
"Artistic-2.0",
"MIT"
] | 2 | 2015-01-27T20:25:44.000Z | 2015-08-30T14:16:12.000Z | _includes/fp-post-content.html | mitchchn/mitchchn.github.io | 3ad9aeb39dcc08c18b4ad7dde0a2f25d511489af | [
"Artistic-2.0",
"MIT"
] | null | null | null | _includes/fp-post-content.html | mitchchn/mitchchn.github.io | 3ad9aeb39dcc08c18b4ad7dde0a2f25d511489af | [
"Artistic-2.0",
"MIT"
] | 1 | 2019-09-14T22:40:01.000Z | 2019-09-14T22:40:01.000Z | <div class="post-content">
{{post.excerpt}}
<div class="controls">
<p><a class="readlink" href="{{post.url}}">Read more</a></p>
</div>
</div>
</div>
<!-- <footer class = "controls">
<p><em>Got feedback? <a href="http://twitter.com/mitchchn">@mitchchn</a></em></p>
{% if post.tag %}
<a class="tag controls">
<i class="fa fa-tag text-icon"></i><span>{{ post.tag }}</span>
</a>
{% endif %}
<a class="permalink" href={{post.url}}><i class="fa fa-chain text-icon"></i>[PERMALINK]</a>
</footer> --> | 25.25 | 91 | 0.590099 |
963f10cfa23c0ac57b3ae49afca3dbfa135ea912 | 2,063 | php | PHP | tests/Component/RSS/Handler/RemoveSubscriptionHandlerTest.php | PersonalGalaxy/X | cbf3787a37f09e86ae488c8adbe4fd4a0ed34690 | [
"MIT"
] | null | null | null | tests/Component/RSS/Handler/RemoveSubscriptionHandlerTest.php | PersonalGalaxy/X | cbf3787a37f09e86ae488c8adbe4fd4a0ed34690 | [
"MIT"
] | null | null | null | tests/Component/RSS/Handler/RemoveSubscriptionHandlerTest.php | PersonalGalaxy/X | cbf3787a37f09e86ae488c8adbe4fd4a0ed34690 | [
"MIT"
] | null | null | null | <?php
declare(strict_types = 1);
namespace Tests\PersonalGalaxy\X\Component\RSS\Handler;
use PersonalGalaxy\X\Component\RSS\Handler\RemoveSubscriptionHandler;
use PersonalGalaxy\RSS\{
Handler\RemoveSubscriptionHandler as Handler,
Command\RemoveSubscription,
Repository\SubscriptionRepository,
Entity\Subscription,
Entity\Subscription\Identity,
Entity\Subscription\User,
Entity\Subscription\Name,
};
use Innmind\Url\UrlInterface;
use Innmind\Neo4j\DBAL\Connection;
use PHPUnit\Framework\TestCase;
class RemoveSubscriptionHandlerTest extends TestCase
{
public function testInvokation()
{
$handle = new RemoveSubscriptionHandler(
new Handler(
$repository = $this->createMock(SubscriptionRepository::class)
),
$dbal = $this->createMock(Connection::class)
);
$dbal
->expects($this->once())
->method('execute')
->with($this->callback(static function($query): bool {
return (string) $query === 'MATCH (subscription:RSS:Subscription { identity: {identity} }) WITH subscription MATCH (subscription)-[rel:OWNED_BY]-(:User), (subscription)-[relationships:FETCHED_IN]-(articles:RSS:Article) WITH collect(relationships) as relationships, rel DELETE rel FOREACH (relationship in relationships | DELETE relationship)' &&
$query->parameters()->get('identity')->value() === 'subscription uuid';
}));
$identity = $this->createMock(Identity::class);
$identity
->expects($this->once())
->method('__toString')
->willReturn('subscription uuid');
$repository
->expects($this->once())
->method('get')
->willReturn(Subscription::add(
$identity,
$this->createMock(User::class),
new Name('foo'),
$this->createMock(UrlInterface::class)
));
$this->assertNull($handle(new RemoveSubscription($identity)));
}
}
| 37.509091 | 361 | 0.626272 |
af86f71fe9e5ec5d218634b06714f72c12e71fb3 | 1,280 | kt | Kotlin | engine/src/main/kotlin/fi/thakki/sudokusolver/engine/model/Cell.kt | terohakkarainen/sudoku-solver | bdc74111cfc4b7425ea2c5383d93b9fdfb2628b5 | [
"MIT"
] | null | null | null | engine/src/main/kotlin/fi/thakki/sudokusolver/engine/model/Cell.kt | terohakkarainen/sudoku-solver | bdc74111cfc4b7425ea2c5383d93b9fdfb2628b5 | [
"MIT"
] | null | null | null | engine/src/main/kotlin/fi/thakki/sudokusolver/engine/model/Cell.kt | terohakkarainen/sudoku-solver | bdc74111cfc4b7425ea2c5383d93b9fdfb2628b5 | [
"MIT"
] | null | null | null | package fi.thakki.sudokusolver.engine.model
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
enum class CellValueType {
SETTABLE,
GIVEN
}
@Serializable
data class Cell(val coordinates: Coordinates, private val symbols: Symbols) {
@Serializable
data class Analysis(
var candidates: Set<Symbol> = emptySet(),
@Transient
var strongLinks: Set<StrongLink> = emptySet()
)
var value: Symbol? = null
set(newValue) {
field = newValue
analysis.candidates = if (newValue != null) emptySet() else symbols
analysis.strongLinks = emptySet()
}
var type: CellValueType = CellValueType.SETTABLE
val analysis = Analysis(candidates = symbols)
fun hasValue(): Boolean =
value != null
fun setGiven(value: Symbol) {
this.value = value
type = CellValueType.GIVEN
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as Cell
return coordinates == other.coordinates
}
override fun hashCode(): Int = coordinates.hashCode()
override fun toString(): String =
"Cell$coordinates=$value"
}
| 25.6 | 79 | 0.64375 |
be59570c7feda16809f7de6bab938e53d7bbef6c | 1,108 | rs | Rust | tests/spec/non_conformant/basic/t18_mixin_scope.rs | becmer/rsass | 7ef8b2ce6c283e5c3546640e57e62f306ed96c32 | [
"Apache-2.0"
] | 329 | 2017-02-18T12:39:56.000Z | 2022-03-31T06:52:18.000Z | tests/spec/non_conformant/basic/t18_mixin_scope.rs | becmer/rsass | 7ef8b2ce6c283e5c3546640e57e62f306ed96c32 | [
"Apache-2.0"
] | 73 | 2017-04-28T19:26:26.000Z | 2022-03-05T15:51:09.000Z | tests/spec/non_conformant/basic/t18_mixin_scope.rs | becmer/rsass | 7ef8b2ce6c283e5c3546640e57e62f306ed96c32 | [
"Apache-2.0"
] | 27 | 2017-06-05T23:02:14.000Z | 2022-03-28T00:42:52.000Z | //! Tests auto-converted from "sass-spec/spec/non_conformant/basic/18_mixin_scope.hrx"
#[allow(unused)]
fn runner() -> crate::TestRunner {
super::runner()
}
#[test]
fn test() {
assert_eq!(
runner().ok("$x: global x;\
\n$y: global y;\n\
\n@mixin foo($x) {\
\n f-a: $x;\
\n f-b: $y;\
\n $x: local x changed by foo;\
\n $y: global y changed by foo !global;\
\n $z: new local z;\
\n f-a: $x;\
\n f-b: $y;\
\n f-c: $z;\
\n}\n\
\ndiv {\
\n a: $x;\
\n b: $y;\
\n @include foo(arg);\
\n a: $x;\
\n b: $y;\
\n}\n"),
"div {\
\n a: global x;\
\n b: global y;\
\n f-a: arg;\
\n f-b: global y;\
\n f-a: local x changed by foo;\
\n f-b: global y changed by foo;\
\n f-c: new local z;\
\n a: global x;\
\n b: global y changed by foo;\
\n}\n"
);
}
| 25.767442 | 86 | 0.366426 |
abbf92a9cb66a30323aa25475353eda5b187cdf4 | 11,262 | sql | SQL | techdomotica.sql | xman40100/techdomotica-java | e124a179f8c1fa7d1a850a0ffc1b4fd5297a67ad | [
"Apache-2.0"
] | 4 | 2019-04-29T14:56:34.000Z | 2019-06-16T02:40:22.000Z | techdomotica.sql | xman40100/technomotica-java | e124a179f8c1fa7d1a850a0ffc1b4fd5297a67ad | [
"Apache-2.0"
] | null | null | null | techdomotica.sql | xman40100/technomotica-java | e124a179f8c1fa7d1a850a0ffc1b4fd5297a67ad | [
"Apache-2.0"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost
-- Tiempo de generación: 29-05-2019 a las 18:48:37
-- Versión del servidor: 10.1.39-MariaDB
-- Versión de PHP: 7.3.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `techdomotica`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `acondicionado`
--
CREATE TABLE `acondicionado` (
`id_Acondicionado` int(11) NOT NULL,
`id_componente` int(11) NOT NULL,
`temperatura` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `camara`
--
CREATE TABLE `camara` (
`id_camara` int(11) NOT NULL,
`id_componente` int(11) NOT NULL,
`resolucion` varchar(45) NOT NULL,
`ubicacion` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `componente`
--
CREATE TABLE `componente` (
`id_componente` int(11) NOT NULL,
`id_usuario` int(11) NOT NULL,
`nom_componente` varchar(30) NOT NULL,
`marca` varchar(30) NOT NULL,
`uso` double NOT NULL,
`gasto_energetico` double NOT NULL,
`componente_on` tinyint(4) NOT NULL,
`habilitado` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `evento`
--
CREATE TABLE `evento` (
`id_evento` int(11) NOT NULL,
`id_perfil` int(11) NOT NULL,
`habilitado` tinyint(1) NOT NULL,
`fecha` date NOT NULL,
`hora` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `luz`
--
CREATE TABLE `luz` (
`id_luz` int(11) NOT NULL,
`id_componente` int(11) NOT NULL,
`encendido` tinyint(4) NOT NULL,
`intensidad` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `perfil`
--
CREATE TABLE `perfil` (
`id_perfil` int(11) NOT NULL,
`id_usuario` int(11) NOT NULL,
`temp1` int(11) DEFAULT '0',
`temp2` int(11) DEFAULT '0',
`temp1_on` tinyint(4) DEFAULT '0',
`temp2_on` tinyint(4) DEFAULT '0',
`proyector_on` tinyint(4) DEFAULT '0',
`sensor1_on` tinyint(1) DEFAULT '0',
`sensor2_on` tinyint(1) DEFAULT '0',
`habilitado` tinyint(1) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `reporte`
--
CREATE TABLE `reporte` (
`id_reporte` int(11) NOT NULL,
`id_usuario` int(11) NOT NULL,
`id_tr` int(11) NOT NULL,
`fecha` date NOT NULL,
`hora` time NOT NULL,
`texto` varchar(1000) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `rol`
--
CREATE TABLE `rol` (
`id_rol` int(11) NOT NULL,
`tipo_rol` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `rol`
--
INSERT INTO `rol` (`id_rol`, `tipo_rol`) VALUES
(1, 'Administrador'),
(2, 'Usuario');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `sensor`
--
CREATE TABLE `sensor` (
`id_sensor` int(11) NOT NULL,
`id_componente` int(11) NOT NULL,
`tiposensor` varchar(45) NOT NULL,
`ubicacion` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tipo_reporte`
--
CREATE TABLE `tipo_reporte` (
`id_tr` int(11) NOT NULL,
`nombre` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `tipo_reporte`
--
INSERT INTO `tipo_reporte` (`id_tr`, `nombre`) VALUES
(1, 'Inicio de sesión'),
(2, 'Registro de usuario'),
(3, 'Dispositivos - agregado'),
(4, 'Dispositivos - modificado'),
(5, 'Dispositivos - reparado'),
(6, 'Cierre de sesión'),
(7, 'Intento de inicio de sesión'),
(8, 'Personalizado'),
(9, 'Cambio de contraseña'),
(10, 'Usuario deshabilitado'),
(11, 'Dispositivo deshabilitado'),
(12, 'Perfil - creado'),
(13, 'Perfil - modificado'),
(14, 'Perfil - deshabilitado'),
(15, 'Evento - creado'),
(16, 'Evento - deshabilitado');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tv`
--
CREATE TABLE `tv` (
`id_tv` int(11) NOT NULL,
`id_componente` int(11) NOT NULL,
`calidadtv` varchar(45) NOT NULL,
`resolucion` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `usuario`
--
CREATE TABLE `usuario` (
`id_usuario` int(11) NOT NULL,
`id_rol` int(11) NOT NULL,
`correo` varchar(45) NOT NULL,
`password` varchar(64) NOT NULL,
`nom1` varchar(30) NOT NULL,
`nom2` varchar(30) NOT NULL,
`apellido1` varchar(30) NOT NULL,
`apellido2` varchar(30) NOT NULL,
`dni` int(30) NOT NULL,
`habilitado` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Volcado de datos para la tabla `usuario`
--
INSERT INTO `usuario` (`id_usuario`, `id_rol`, `correo`, `password`, `nom1`, `nom2`, `apellido1`, `apellido2`, `dni`, `habilitado`) VALUES
(1, 1, 'admin@techdomotica.com', 'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3', 'Administrador', '', 'Tech Domótica', '', 123, 1),
(2, 2, 'usuario@techdomotica.com', 'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3', 'Usuario', '', 'Tech Domótica', '', 321, 1);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `acondicionado`
--
ALTER TABLE `acondicionado`
ADD PRIMARY KEY (`id_Acondicionado`),
ADD KEY `id_componente` (`id_componente`);
--
-- Indices de la tabla `camara`
--
ALTER TABLE `camara`
ADD PRIMARY KEY (`id_camara`),
ADD KEY `id_componente` (`id_componente`);
--
-- Indices de la tabla `componente`
--
ALTER TABLE `componente`
ADD PRIMARY KEY (`id_componente`),
ADD KEY `id_usuario` (`id_usuario`);
--
-- Indices de la tabla `evento`
--
ALTER TABLE `evento`
ADD PRIMARY KEY (`id_evento`),
ADD KEY `id_perfil` (`id_perfil`);
--
-- Indices de la tabla `luz`
--
ALTER TABLE `luz`
ADD PRIMARY KEY (`id_luz`),
ADD KEY `id_componente` (`id_componente`);
--
-- Indices de la tabla `perfil`
--
ALTER TABLE `perfil`
ADD PRIMARY KEY (`id_perfil`),
ADD KEY `fk_usuario_perfil` (`id_usuario`);
--
-- Indices de la tabla `reporte`
--
ALTER TABLE `reporte`
ADD PRIMARY KEY (`id_reporte`),
ADD KEY `id_usuario` (`id_usuario`),
ADD KEY `id_tr` (`id_tr`);
--
-- Indices de la tabla `rol`
--
ALTER TABLE `rol`
ADD PRIMARY KEY (`id_rol`);
--
-- Indices de la tabla `sensor`
--
ALTER TABLE `sensor`
ADD PRIMARY KEY (`id_sensor`),
ADD KEY `id_componente` (`id_componente`);
--
-- Indices de la tabla `tipo_reporte`
--
ALTER TABLE `tipo_reporte`
ADD PRIMARY KEY (`id_tr`);
--
-- Indices de la tabla `tv`
--
ALTER TABLE `tv`
ADD PRIMARY KEY (`id_tv`),
ADD KEY `id_componente` (`id_componente`);
--
-- Indices de la tabla `usuario`
--
ALTER TABLE `usuario`
ADD PRIMARY KEY (`id_usuario`),
ADD KEY `id_rol` (`id_rol`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `acondicionado`
--
ALTER TABLE `acondicionado`
MODIFY `id_Acondicionado` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `camara`
--
ALTER TABLE `camara`
MODIFY `id_camara` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `componente`
--
ALTER TABLE `componente`
MODIFY `id_componente` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `evento`
--
ALTER TABLE `evento`
MODIFY `id_evento` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `luz`
--
ALTER TABLE `luz`
MODIFY `id_luz` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `perfil`
--
ALTER TABLE `perfil`
MODIFY `id_perfil` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `reporte`
--
ALTER TABLE `reporte`
MODIFY `id_reporte` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `rol`
--
ALTER TABLE `rol`
MODIFY `id_rol` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `sensor`
--
ALTER TABLE `sensor`
MODIFY `id_sensor` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `tipo_reporte`
--
ALTER TABLE `tipo_reporte`
MODIFY `id_tr` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
--
-- AUTO_INCREMENT de la tabla `tv`
--
ALTER TABLE `tv`
MODIFY `id_tv` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `usuario`
--
ALTER TABLE `usuario`
MODIFY `id_usuario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `acondicionado`
--
ALTER TABLE `acondicionado`
ADD CONSTRAINT `acondicionado_ibfk_1` FOREIGN KEY (`id_componente`) REFERENCES `componente` (`id_componente`);
--
-- Filtros para la tabla `camara`
--
ALTER TABLE `camara`
ADD CONSTRAINT `camara_ibfk_1` FOREIGN KEY (`id_componente`) REFERENCES `componente` (`id_componente`);
--
-- Filtros para la tabla `componente`
--
ALTER TABLE `componente`
ADD CONSTRAINT `componente_ibfk_1` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`);
--
-- Filtros para la tabla `evento`
--
ALTER TABLE `evento`
ADD CONSTRAINT `evento_ibfk_1` FOREIGN KEY (`id_perfil`) REFERENCES `perfil` (`id_perfil`);
--
-- Filtros para la tabla `luz`
--
ALTER TABLE `luz`
ADD CONSTRAINT `luz_ibfk_1` FOREIGN KEY (`id_componente`) REFERENCES `componente` (`id_componente`);
--
-- Filtros para la tabla `perfil`
--
ALTER TABLE `perfil`
ADD CONSTRAINT `fk_usuario_perfil` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `reporte`
--
ALTER TABLE `reporte`
ADD CONSTRAINT `reporte_ibfk_1` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`),
ADD CONSTRAINT `reporte_ibfk_2` FOREIGN KEY (`id_tr`) REFERENCES `tipo_reporte` (`id_tr`);
--
-- Filtros para la tabla `sensor`
--
ALTER TABLE `sensor`
ADD CONSTRAINT `sensor_ibfk_1` FOREIGN KEY (`id_componente`) REFERENCES `componente` (`id_componente`);
--
-- Filtros para la tabla `tv`
--
ALTER TABLE `tv`
ADD CONSTRAINT `tv_ibfk_1` FOREIGN KEY (`id_componente`) REFERENCES `componente` (`id_componente`);
--
-- Filtros para la tabla `usuario`
--
ALTER TABLE `usuario`
ADD CONSTRAINT `usuario_ibfk_1` FOREIGN KEY (`id_rol`) REFERENCES `rol` (`id_rol`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 24.219355 | 151 | 0.65095 |
40d52a7e3a4e61660203e96653e5846bf97c8c63 | 2,086 | py | Python | 07_classes/05_inheritance.py | ghimiresdp/python-level1 | a41f484c7c6e2e012d1d2e223f9eaa2d4dd98c3f | [
"MIT"
] | 1 | 2021-07-05T16:50:49.000Z | 2021-07-05T16:50:49.000Z | 07_classes/05_inheritance.py | ghimiresdp/python-level1 | a41f484c7c6e2e012d1d2e223f9eaa2d4dd98c3f | [
"MIT"
] | null | null | null | 07_classes/05_inheritance.py | ghimiresdp/python-level1 | a41f484c7c6e2e012d1d2e223f9eaa2d4dd98c3f | [
"MIT"
] | 7 | 2022-01-19T00:35:21.000Z | 2022-03-28T04:27:34.000Z | # © https://sudipghimire.com.np
# %% [markdown]
"""
# Inheritance
- This concept is exactly similar to biological inheritance where child inherits the feature of parent.
- in inheritance, there exists a parent class and child classes which inherits parent's behaviors.
- The base class will be the parent class and the class that is derived from the base class will
be treated as a child class.
Basic Structure
class Parent:
<attributes>
<methods>
class Child(Parent):
<attributes>
<methods>
Rectangle
attributes:
- width
- height
methods:
- perimeter
- area
variants:
square
Animal
attributes:
- legs: 4
- tail
variants:
- Pet
- Wild
- Herbivorous
- Carnivorous
"""
# %% Example Rectangle
class Rectangle:
width: float = 0
height: float = 0
def __init__(self, width, height):
self.width = width
self.height = height
def perimeter(self):
return 2 * (self.width + self.height)
def area(self):
return self.width * self.height
def diagonal_length(self):
return (self.width ** 2 + self.height ** 2) ** (1 / 2)
# %% child
class Square(Rectangle):
def __init__(self, width):
super().__init__(width=width, height=width)
def diagonal_length(self):
return self.width * (2 ** .5)
# %%
room_1 = Rectangle(5, 10)
print(f'Area of room 1: {room_1.area()}')
print(f'Perimeter of room 1: {room_1.perimeter()}')
print(f'Diagonal length of room 1: {room_1.diagonal_length()}')
# %%
room_2 = Square(5)
print(f'Area of room 2: {room_2.area()}')
print(f'Perimeter of room 2: {room_2.perimeter()}')
print(f'Diagonal length of room 2: {room_2.diagonal_length()}')
# %% builtin functions
# isinstance
print(isinstance(room_2, Square))
print(isinstance(room_1, Rectangle))
print(isinstance(room_1, Square))
print(isinstance(room_2, Rectangle))
# %% issubclass
print(issubclass(Square, Rectangle))
print(issubclass(Rectangle, Square))
print(issubclass(Rectangle, object))
| 20.86 | 103 | 0.650527 |
1a38af558024d118cfefdfcdb4358403a16c1560 | 767 | asm | Assembly | Borland/CBuilder5/Source/RTL/source/cstrings/__strstr.asm | TrevorDArcyEvans/DivingMagpieSoftware | 7ffcfef653b110e514d5db735d11be0aae9953ec | [
"MIT"
] | 1 | 2021-05-27T10:27:25.000Z | 2021-05-27T10:27:25.000Z | Borland/CBuilder5/Source/RTL/source/cstrings/__strstr.asm | TrevorDArcyEvans/Diving-Magpie-Software | 7ffcfef653b110e514d5db735d11be0aae9953ec | [
"MIT"
] | null | null | null | Borland/CBuilder5/Source/RTL/source/cstrings/__strstr.asm | TrevorDArcyEvans/Diving-Magpie-Software | 7ffcfef653b110e514d5db735d11be0aae9953ec | [
"MIT"
] | null | null | null | ;-----------------------------------------------------------------------
; filename - __strstr.asm
;
; function(s)
;
; jump stub for C++ implementation of strstr()
;-----------------------------------------------------------------------
;
; C/C++ Run Time Library - Version 10.0
;
; Copyright (c) 1987, 2000 by Inprise Corporation
; All Rights Reserved.
;
; $Revision: 9.2 $
include RULES.ASI
; Segments Definitions
Header@
ExtFunc@ strstr, _RTLENTRY
Code_seg@
Func@ @std@strstr$qpxct1, public, pascal
jmp strstr@
EndFunc@ @std@strstr$qpxct1
Func@ @std@strstr$qpcpxc, public, pascal
jmp strstr@
EndFunc@ @std@strstr$qpcpxc
Code_EndS@
end
| 19.666667 | 72 | 0.468057 |
420207bce07e63331a47a3b73281b6fddb74b200 | 291 | html | HTML | Web/templates/index.html | Hacker-Davinci/Deep_Fake_Detecion_API | 81ff1e1feb0c57a3ad827be59d83d3346630723b | [
"MIT"
] | 1 | 2021-12-17T00:31:54.000Z | 2021-12-17T00:31:54.000Z | Web/templates/index.html | Hacker-Davinci/Deep_Fake_Detecion_API | 81ff1e1feb0c57a3ad827be59d83d3346630723b | [
"MIT"
] | null | null | null | Web/templates/index.html | Hacker-Davinci/Deep_Fake_Detecion_API | 81ff1e1feb0c57a3ad827be59d83d3346630723b | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h1>Let's detect Deepfake picture !</h1>
<form method="post" enctype="multipart/form-data" action="/upload">
<input type="file" name="file">
<input type="submit" value="Upload">
</form>
</body>
</html> | 22.384615 | 69 | 0.618557 |
c01d7fca49aaa8a47c541a0e44b2afcd629a4b01 | 5,887 | lua | Lua | game/dota_addons/spelllibrary/scripts/vscripts/heroes/hero_invoker/deafening_blast.lua | XavierCHN/SpellLibrary | ca6d5b3ea6bf9177b38a1e6e38d782d77639eec1 | [
"CC-BY-2.0"
] | 2 | 2015-10-23T16:26:22.000Z | 2019-11-03T08:33:56.000Z | game/dota_addons/spelllibrary/scripts/vscripts/heroes/hero_invoker/deafening_blast.lua | XavierCHN/SpellLibrary | ca6d5b3ea6bf9177b38a1e6e38d782d77639eec1 | [
"CC-BY-2.0"
] | null | null | null | game/dota_addons/spelllibrary/scripts/vscripts/heroes/hero_invoker/deafening_blast.lua | XavierCHN/SpellLibrary | ca6d5b3ea6bf9177b38a1e6e38d782d77639eec1 | [
"CC-BY-2.0"
] | 3 | 2015-10-27T13:30:45.000Z | 2020-04-01T11:09:53.000Z | --[[Author: Pizzalol
Date: 21.04.2015.
Creates a dummy with a dummy deafening spell
The dummy acts as the projectile while following the particle projectile]]
function deafening_blast_start( keys )
local caster = keys.caster
local caster_location = caster:GetAbsOrigin()
local target_point = keys.target_points[1]
local ability = keys.ability
local ability_level = ability:GetLevel() - 1
local quas_level = caster:FindAbilityByName("invoker_quas_datadriven"):GetLevel() - 1
-- Ability and projectile variables
local knockback_duration = ability:GetLevelSpecialValueFor("knockback_duration", quas_level) + 0.1
local travel_distance = ability:GetLevelSpecialValueFor("travel_distance", ability_level)
local travel_speed = ability:GetLevelSpecialValueFor("travel_speed", ability_level)
local radius_start = ability:GetLevelSpecialValueFor("radius_start", ability_level)
local radius_end = ability:GetLevelSpecialValueFor("radius_end", ability_level)
local dummy_ability_name = keys.dummy_ability_name
local projectile_name = keys.projectile_name
local direction = (target_point - caster_location):Normalized()
-- Create the dummy
local deafening_dummy = CreateUnitByName("npc_dummy_blank", caster_location, false, caster, caster, caster:GetTeamNumber())
deafening_dummy:AddAbility(dummy_ability_name)
-- Set up the dummy ability
local dummy_ability = deafening_dummy:FindAbilityByName(dummy_ability_name)
dummy_ability:SetLevel(1)
-- Initialize the dummy calculation variables
local distance_traveled = 0
local dummy_speed = travel_speed * 1/30
-- Create projectile
local projectile_table =
{
EffectName = projectile_name,
Ability = dummy_ability,
vSpawnOrigin = caster_location,
vVelocity = direction * travel_speed,
fDistance = travel_distance,
fStartRadius = radius_start,
fEndRadius = radius_end,
Source = deafening_dummy,
bHasFrontalCone = true,
bReplaceExisting = false,
iUnitTargetTeam = ability:GetAbilityTargetTeam(),
iUnitTargetFlags = ability:GetAbilityTargetFlags(),
iUnitTargetType = ability:GetAbilityTargetType()
}
ProjectileManager:CreateLinearProjectile( projectile_table )
-- Move the dummy
Timers:CreateTimer(function()
-- If the dummy traveled the whole distance then kill it
if distance_traveled < travel_distance then
-- Otherwise keep track of the distance traveled and set the new position
local dummy_location = deafening_dummy:GetAbsOrigin() + direction * dummy_speed
deafening_dummy:SetAbsOrigin(dummy_location)
distance_traveled = distance_traveled + dummy_speed
return 1/30
else
-- Remove the dummy after the knockback duration to allow all the modifiers to be applied
Timers:CreateTimer(knockback_duration,function()
deafening_dummy:RemoveSelf()
end)
end
end)
end
--[[Author: Pizzalol
Date: 21.04.2015.
Triggers upon hitting a target
Deals damage depending on Exort and applies the knockback modifier depending on Quas]]
function deafening_blast_hit( keys )
local caster = keys.caster -- Dummy
local caster_owner = caster:GetOwner() -- Hero
local target = keys.target
local ability = keys.ability
local owner_ability = caster_owner:FindAbilityByName("invoker_deafening_blast_datadriven")
local exort_level = caster_owner:FindAbilityByName("invoker_exort_datadriven"):GetLevel() - 1
local quas_level = caster_owner:FindAbilityByName("invoker_quas_datadriven"):GetLevel() - 1
-- Ability variables
local damage = owner_ability:GetLevelSpecialValueFor("damage", exort_level)
local knockback_duration = owner_ability:GetLevelSpecialValueFor("knockback_duration", quas_level)
local knockback_modifier = keys.knockback_modifier
-- Apply the knockback modifier
ability:ApplyDataDrivenModifier(caster, target, knockback_modifier, {duration = knockback_duration})
-- Initialize the damage table and deal the damage
local damage_table = {}
damage_table.attacker = caster_owner
damage_table.victim = target
damage_table.ability = owner_ability
damage_table.damage_type = owner_ability:GetAbilityDamageType()
damage_table.damage = damage
ApplyDamage(damage_table)
end
--[[Author: Pizzalol
Date: 21.04.2015.
Keeps track of the caster and the direction in which to be knocked back]]
function deafening_blast_knockback_start( keys )
local caster = keys.caster -- Dummy
local caster_owner = caster:GetOwner() -- Hero
local caster_location = caster:GetAbsOrigin()
local target = keys.target
local target_location = target:GetAbsOrigin()
target.deafening_direction = (target_location - caster_location):Normalized()
target.deafening_caster = caster_owner
end
--[[Author: Pizzalol
Date: 21.04.2015.
Triggers on an interval in the knockback modifier, moves the target]]
function deafening_blast_knockback( keys )
local target = keys.target
local target_location = target:GetAbsOrigin()
local knockback_speed = 6
local new_location = target_location + target.deafening_direction * knockback_speed
target:SetAbsOrigin(GetGroundPosition(new_location, target))
end
--[[Author: Pizzalol
Date: 21.04.2015.
Triggers upon the expiration of the knockback modifier
Applies a disarm modifier depending on the Wex level]]
function deafening_blast_disarm( keys )
local target = keys.target
local caster = target.deafening_caster -- Hero
local ability = keys.ability -- Dummy ability
local owner_ability = caster:FindAbilityByName("invoker_deafening_blast_datadriven")
local wex_level = caster:FindAbilityByName("invoker_wex_datadriven"):GetLevel() - 1
local disarm_duration = owner_ability:GetLevelSpecialValueFor("disarm_duration", wex_level)
local disarm_modifier = keys.disarm_modifier
-- Check if the target is alive(to prevent errors when the deafening blast is the killing blow)
if target:IsAlive() then
ability:ApplyDataDrivenModifier(caster, target, disarm_modifier, {duration = disarm_duration})
end
end | 39.246667 | 124 | 0.79701 |
6e4b29e477a62a10d8f69745a1e4b22d2ff8a4ae | 423 | kt | Kotlin | app/src/main/java/com/example/githubuserapp/presentation/ui/fragment/favorite/FavoriteViewState.kt | holis12821/github-users | 3356405f190659ff54a040f174436c689803d036 | [
"Apache-2.0"
] | 3 | 2021-11-23T04:13:22.000Z | 2021-12-26T06:17:34.000Z | app/src/main/java/com/example/githubuserapp/presentation/ui/fragment/favorite/FavoriteViewState.kt | holis12821/github-users | 3356405f190659ff54a040f174436c689803d036 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/githubuserapp/presentation/ui/fragment/favorite/FavoriteViewState.kt | holis12821/github-users | 3356405f190659ff54a040f174436c689803d036 | [
"Apache-2.0"
] | null | null | null | package com.example.githubuserapp.presentation.ui.fragment.favorite
import com.example.githubuserapp.data.response.model.ItemsItem
sealed class FavoriteViewState {
object Init: FavoriteViewState()
data class Progress(val isLoading: Boolean): FavoriteViewState()
data class ShowMessage(val message: String): FavoriteViewState()
data class ShowDataFavorite(val list: List<ItemsItem>?): FavoriteViewState()
} | 42.3 | 80 | 0.799054 |
74afe417cc9018ac1fa4e2d26479cb23d6847c40 | 313 | kt | Kotlin | solitaireapp/src/main/java/lucassales/com/br/ui/base/BaseViewModel.kt | lucassales2/CardGame | fc6db5e6de890e075fcb8a215721b8ca7bc2f8ad | [
"MIT"
] | null | null | null | solitaireapp/src/main/java/lucassales/com/br/ui/base/BaseViewModel.kt | lucassales2/CardGame | fc6db5e6de890e075fcb8a215721b8ca7bc2f8ad | [
"MIT"
] | null | null | null | solitaireapp/src/main/java/lucassales/com/br/ui/base/BaseViewModel.kt | lucassales2/CardGame | fc6db5e6de890e075fcb8a215721b8ca7bc2f8ad | [
"MIT"
] | null | null | null | package lucassales.com.br.ui.base
import androidx.lifecycle.ViewModel
import io.reactivex.disposables.CompositeDisposable
open class BaseViewModel : ViewModel() {
protected val disposables = CompositeDisposable()
override fun onCleared() {
super.onCleared()
disposables.clear()
}
} | 22.357143 | 53 | 0.734824 |
0be8866082a7ed3aafcc24e07b35c8e38c32e4eb | 139 | js | JavaScript | b2ml_/web/script.js | jeanoliveira92/teste-adminissao-b2ml | 51664a97d5651192ecded66d6ac700d8fc39c13b | [
"MIT"
] | null | null | null | b2ml_/web/script.js | jeanoliveira92/teste-adminissao-b2ml | 51664a97d5651192ecded66d6ac700d8fc39c13b | [
"MIT"
] | null | null | null | b2ml_/web/script.js | jeanoliveira92/teste-adminissao-b2ml | 51664a97d5651192ecded66d6ac700d8fc39c13b | [
"MIT"
] | null | null | null | $('body').ready(() => {
setTimeout(() => {
$('.alert').addClass('hide');
$('.error').addClass('hide');
}, 5000);
}) | 23.166667 | 37 | 0.410072 |
f27c4bad7964c3efc9fd1e96a815e1d1ba1eb1ae | 212 | swift | Swift | CodeBaseProject/AppData/AppDataPresentation.swift | haiphamthanh/CodeBaseProject | e5991ff6538f7157124206b08bfc6e85e33c411a | [
"MIT"
] | null | null | null | CodeBaseProject/AppData/AppDataPresentation.swift | haiphamthanh/CodeBaseProject | e5991ff6538f7157124206b08bfc6e85e33c411a | [
"MIT"
] | 1 | 2022-03-24T21:22:14.000Z | 2022-03-24T21:22:14.000Z | CodeBaseProject/AppData/AppDataPresentation.swift | haiphamthanh/CodeBaseProject | e5991ff6538f7157124206b08bfc6e85e33c411a | [
"MIT"
] | null | null | null | //
// AppDataPresentation.swift
// CodeBaseProject
//
// Created by HaiKaito on 03/04/2022.
//
import Foundation
protocol AppDataPresentation {
associatedtype AppDataType
func asAppData() -> AppDataType
}
| 15.142857 | 38 | 0.745283 |
330b3963d9b73c6852bb584edb372432594c7bc6 | 729 | kt | Kotlin | app/src/main/java/com/androidstudy/huaweihms/views/viewmodel/MapViewModel.kt | jumaallan/huawei-hms | 62b539416dd474f02a1bf818402c38637eb16719 | [
"MIT"
] | 16 | 2020-04-15T01:53:50.000Z | 2021-12-09T20:52:58.000Z | app/src/main/java/com/androidstudy/huaweihms/views/viewmodel/MapViewModel.kt | jumaallan/huawei-hms | 62b539416dd474f02a1bf818402c38637eb16719 | [
"MIT"
] | null | null | null | app/src/main/java/com/androidstudy/huaweihms/views/viewmodel/MapViewModel.kt | jumaallan/huawei-hms | 62b539416dd474f02a1bf818402c38637eb16719 | [
"MIT"
] | 1 | 2021-12-06T18:16:45.000Z | 2021-12-06T18:16:45.000Z | package com.androidstudy.huaweihms.views.viewmodel
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.androidstudy.huaweihms.data.remote.LocationRequest
import com.androidstudy.huaweihms.repository.MapRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class MapViewModel(
private val mapRepository: MapRepository
) : ViewModel() {
var locationDescriptions = mapRepository.getLocationDescriptions()
fun nukeTable() {
mapRepository.nukeTable()
}
fun getReverseGeoCode(locationRequest: LocationRequest) {
viewModelScope.launch(Dispatchers.IO) {
mapRepository.getReverseGeoCode(locationRequest)
}
}
} | 29.16 | 70 | 0.77915 |
7769f50b80e3b83e856b3e170b6ed51134607262 | 32,929 | html | HTML | api/mt7697/group___s_p_i___s_l_a_v_e.html | MediaTek-Labs/labs.mediatek.com | cd5837ff4e855fbc438635064b7d406858ac020e | [
"FSFAP"
] | null | null | null | api/mt7697/group___s_p_i___s_l_a_v_e.html | MediaTek-Labs/labs.mediatek.com | cd5837ff4e855fbc438635064b7d406858ac020e | [
"FSFAP"
] | null | null | null | api/mt7697/group___s_p_i___s_l_a_v_e.html | MediaTek-Labs/labs.mediatek.com | cd5837ff4e855fbc438635064b7d406858ac020e | [
"FSFAP"
] | null | null | null | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Mirrored from labs.mediatek.com/api/mt7697/group___s_p_i___s_l_a_v_e.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 18 Aug 2021 07:12:56 GMT -->
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>MT7697 API Reference: SPI_SLAVE</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="MediaTek.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">MT7697 API Reference
 <span id="projectnumber">LinkIt SDK v4</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index-2.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li class="current"><a href="modules.html"><span>API Reference</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group___s_p_i___s_l_a_v_e.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> |
<a href="#groups">Modules</a> </div>
<div class="headertitle">
<div class="title">SPI_SLAVE<div class="ingroups"><a class="el" href="group___h_a_l.html">HAL</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>This section introduces the SPI Slave APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, enums, structures and functions.
<a href="#details">More...</a></p>
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<p>This section introduces the SPI Slave APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, enums, structures and functions. </p>
<h1><a class="anchor" id="HAL_SPI_SLAVE_Terms_Chapter"></a>
Terms and acronyms</h1>
<table class="doxtable">
<tr>
<th>Terms </th><th>Details </th></tr>
<tr>
<td><b>DMA</b> </td><td>Direct Memory Access. DMA is a feature of computer systems that allows certain hardware subsystems to access main system memory independent from the central processing unit (CPU). </td></tr>
<tr>
<td><b>GPIO</b> </td><td>General Purpose Inputs-Outputs. For more details, please refer to <a class="el" href="group___g_p_i_o.html">GPIO</a>. </td></tr>
<tr>
<td><b>IRQ</b> </td><td>Interrupt Request. For more information, please refer to <a href="https://en.wikipedia.org/wiki/Interrupt_request_(PC_architecture)">IRQ</a>. </td></tr>
<tr>
<td><b>MISO</b> </td><td>Master Input, Slave Output. Output from the SPI slave. </td></tr>
<tr>
<td><b>MOSI</b> </td><td>Master Output, Slave Input. Output from the SPI master. </td></tr>
<tr>
<td><b>NVIC</b> </td><td>Nested Vectored Interrupt Controller. NVIC is the interrupt controller of ARM Cortex-M series processors. For more details, please refer to <a href="http://infocenter.arm.com/help/topic/com.arm.doc.100166_0001_00_en/arm_cortexm4_processor_trm_100166_0001_00_en.pdf">ARM Cortex-M4 technical reference manual</a>. </td></tr>
<tr>
<td><b>SCLK</b> </td><td>Serial Clock. Output from the SPI master. </td></tr>
<tr>
<td><b>SPI</b> </td><td>Serial Peripheral Interface. The Serial Peripheral Interface bus is a synchronous serial communication interface specification used for short distance communication. For more information, please refer to <a href="https://en.wikipedia.org/wiki/Serial_peripheral_interface">Serial Peripheral Interface Bus in Wikipedia</a>. </td></tr>
<tr>
<td><b>SS</b> </td><td>Slave Select. Output from the SPI master, active low. </td></tr>
</table>
<h1><a class="anchor" id="HAL_SPI_SLAVE_Features_Chapter"></a>
Supported features</h1>
<p>Emerging sensor applications support SPI interface communication. An SPI slave interface is required to communicate with an SPI master interface. This controller is the SPI slave interface with five functional registers for communication.</p><ul>
<li><b>Support</b> <b>functional</b> <b>registers</b>. <br />
There are six registers in this slave controller:<ul>
<li>Reg00 - reads data from the bus.</li>
<li>Reg01 - writes data to the bus.</li>
<li>Reg02 - the address to write/read to/from the bus, the configured value should correspond to a physical address in the system.</li>
<li>Reg03 - the bus protocol command.</li>
<li>Reg04 - the polling status to check whether the bus is idle or busy.</li>
<li>Reg05 - the software IRQ command.</li>
</ul>
</li>
<li><p class="startli"><b>Support</b> <b>standard</b> <b>mode</b> <b>and</b> <b>fast</b> <b>mode</b> <b>programming</b> <b>sequences</b>. <br />
Fast mode supports address auto increment to reduce bus address write time when the SPI slave accesses the system memory. Example 1 and 2 use standard mode. Example 3 and 4 use fast mode. The default driver settings are on fast mode to provide better throughput. <br />
Example 1: Write 0x0123_4567 data to the address 0x1013_0004. <br />
</p><ul>
<li>Step 1. Prepare command to access the bus, the SPI master asserts the following data on MOSI. <br />
{8'h80,8'h04,16'h4567} // Put bus write data[15:0] into the SPI slave reg01[15:0]. <br />
{8'h80,8'h06,16'h0123} // Put bus write data[31:16] into the SPI slave reg01[31:16]. <br />
{8'h80,8'h08,16'h0004} // Put bus address[15:0] into the SPI slave reg02[15:0]. <br />
{8'h80,8'h0A,16'h1013} // Put bus address[31:16] into the SPI slave reg02[31:16]. <br />
{8'h80,8'h0c,{13'b0,2'b10,1'b1}} // Start the bus write access.</li>
</ul>
<p class="startli">Example 2: Read 0x0123_4567 data from the address 0x1013_0004. Note: Check if the status is busy before reading data from the SPI slave controller. <br />
</p><ul>
<li>Step 1. Prepare command to access the bus, the SPI master asserts the following data on MOSI. <br />
{8'h80,8'h08,16'h0004} // Put bus address[15:0] into the SPI slave reg02[15:0]. <br />
{8'h80,8'h0A,16'h1013} // Put bus address[31:16] into the SPI slave reg02[31:16]. <br />
{8'h80,8'h0c,{13'b0,2'b10,1'b0}} // Access the bus to read data. <br />
</li>
<li>Step 2. Wait bus accessing done, the SPI master asserts the following data on MOSI. <br />
{8'h00,8'h10,16'hxxxx} // Read the SPI slave bus interface status. <br />
Wait until the MISO returned data bit[0]=0, make sure that bus access has finished. <br />
</li>
<li>Step 3. Get read data, the SPI master asserts the following data on MOSI. <br />
{8'h00,8'h00,16'hxxxx} // Get bus read data[15:0] from the SPI slave reg00[15:0], <br />
MISO return data 16'h4567. <br />
{8'h00,8'h02,16'hxxxx} // Get bus read data[31:16] from the SPI slave reg00[31:16], <br />
MISO return data 16'h0123.</li>
</ul>
<p class="startli">Example 3: Write 0x0123_4567 data to the address 0x1013_0004. Write 0x89ab_cdef data to the address 0x1013_0008. SPI master sends software IRQ command to trigger SPI slave IRQ. <br />
</p><ul>
<li>Step 1. Prepare command to access the bus, the SPI master asserts the following data on MOSI. <br />
{8'h80,8'h04,16'h4567} // Put bus write data[15:0] into the SPI slave reg01[15:0]. <br />
{8'h80,8'h06,16'h0123} // Put bus write data[31:16] into the SPI slave reg01[31:16]. <br />
{8'h80,8'h08,16'h0004} // Put bus address[15:0] into the SPI slave reg02[15:0]. <br />
{8'h80,8'h0A,16'h1013} // Put bus address[31:16] into the SPI slave reg02[31:16]. <br />
{8'h80,8'h0c,{13'b0,2'b10,1'b1}} // Start the bus write access. <br />
</li>
<li>Step 2. // Address will auto-increment by 4 bytes after the last master transaction. <br />
Prepare command to access the bus, the SPI master asserts the following data on MOSI. <br />
{8'h80,8'h04,16'hcdef} // Put bus write data[15:0] into the SPI slave reg01[15:0]. <br />
{8'h80,8'h06,16'h89ab} // Put bus write data[31:16] into the SPI slave reg01[31:16]. <br />
// No need to write the bus address. <br />
{8'h80,8'h0c,{13'b0,2'b10,1'b1}} // Start the bus write access. <br />
</li>
<li>Step 3. Prepare software IRQ command to access the bus, the SPI master asserts the following data on MOSI. <br />
{8'h80,8'h14,16'h0001} // Write 1 into the SPI slave reg05[0]. <br />
Example 4: Read 0x0123_4567 data from the address 0x1013_0004. Read 0x89ab_cdef data from the address 0x1013_0008. Note: User needs to check busy status before reading the bus data from the SPI slave controller. <br />
</li>
<li>Step 1. Prepare command for bus accessing, SPI master asserts following data on MOSI respectively. <br />
{8'h80,8'h08,16'h0004} // Put bus address[15:0] into the SPI slave reg02[15:0]. <br />
{8'h80,8'h0A,16'h1013} // Put bus address[31:16] into the SPI slave reg02[31:16]. <br />
{8'h80,8'h0c,{13'b0,2'b10,1'b0}} // Start the bus read access. <br />
</li>
<li>Step 2. Wait till the bus access is complete, then the SPI master asserts the following data on MOSI. <br />
{8'h00,8'h10,16'hxxxx} // Read the SPI slave bus interface status. <br />
Wait until the MISO returned data bit[0]=0, make sure that bus access has finished. <br />
</li>
<li>Step 3. Get read data, the SPI master asserts the following data on MOSI. <br />
{8'h00,8'h00,16'hxxxx} // Get bus read data[15:0] from the SPI slave reg00[15:0], <br />
MISO return data 16'h4567. <br />
{8'h00,8'h02,16'hxxxx} // Get bus read data[31:16] from the SPI slave reg00[31:16], <br />
MISO return data 16'h0123. <br />
</li>
<li>Step 4. // No need to write address into reg02. <br />
// User can start reading from the bus immediately. <br />
{8'h80,8'h0c,{13'b0,2'b10,1'b0}} // Start the bus read access. <br />
</li>
<li>Step 5. Wait till the bus access is complete, then the SPI master asserts the following data on MOSI. <br />
{8'h00,8'h10,16'hxxxx} // Read the SPI slave bus interface status. <br />
Wait until the MISO returned data bit[0]=0, make sure that bus access has finished. <br />
</li>
<li>Step 6. Get read data at address 0x1013_0008, the SPI master asserts the following data on MOSI. <br />
{8'h00,8'h00,16'hxxxx} // Get bus read data[15:0] from the SPI slave reg00[15:0], <br />
MISO return data 16'hcdef. <br />
{8'h00,8'h02,16'hxxxx} // Get bus read data[31:16] from the SPI slave reg00[31:16], <br />
MISO return data 16'h89ab. <br />
</li>
</ul>
</li>
</ul>
<h1><a class="anchor" id="HAL_SPI_SLAVE_Architecture_Chapter"></a>
Software architecture of the SPI slave</h1>
<p>The architecture is similar to the interrupt mode architecture in HAL overview. See <a class="el" href="group___h_a_l.html#HAL_Overview_3_Chapter">HAL Driver Model</a> for interrupt mode architecture.</p>
<h1><a class="anchor" id="HAL_SPI_SLAVE_Driver_Usage_Chapter"></a>
How to use this driver</h1>
<p>Call <a class="el" href="group___g_p_i_o.html#ga54dd22211d970fb607bf172a71dca723" title="This function configures the pinmux of target GPIO. ">hal_pinmux_set_function()</a> to pinmux the GPIO pins to four SPI pins (SS, SCLK, MOSI, and MISO) based on the user's hardware platform design. Please note that user should choose the SPI pins for SPI slave, which can support 20MHz SPI clock, to get a better throughput. Then call <a class="el" href="group___s_p_i___s_l_a_v_e.html#gaa977b5ad2693071802c52bbda5a7898d" title="This function initializes the SPI slave and sets user defined common parameters including clock polar...">hal_spi_slave_init()</a> to apply basic settings for SPI slave hardware. After that call <a class="el" href="group___s_p_i___s_l_a_v_e.html#gae9533bf2fe55540dc4ac1daa0bbd1e86" title="This function registers user's callback in the SPI slave driver. ">hal_spi_slave_register_callback()</a> to register a user callback function. The steps are shown below:</p><ul>
<li>Step 1. Call <a class="el" href="group___g_p_i_o.html#ga19985c2e5d4b22d47d08103be800331d" title="This function initializes the GPIO hardware with basic functionality. ">hal_gpio_init()</a> to init the pins, if EPT tool hasn't been used to configure the related pinmux.</li>
<li>Step 2. Call <a class="el" href="group___g_p_i_o.html#ga54dd22211d970fb607bf172a71dca723" title="This function configures the pinmux of target GPIO. ">hal_pinmux_set_function()</a> to set the GPIO pinmux, if the EPT tool wasn't used to configure the related pinmux. For more details about <a class="el" href="group___g_p_i_o.html#ga54dd22211d970fb607bf172a71dca723" title="This function configures the pinmux of target GPIO. ">hal_pinmux_set_function()</a>, please refer to <a class="el" href="group___g_p_i_o.html">GPIO</a>.</li>
<li>Step 3. Call <a class="el" href="group___s_p_i___s_l_a_v_e.html#gaa977b5ad2693071802c52bbda5a7898d" title="This function initializes the SPI slave and sets user defined common parameters including clock polar...">hal_spi_slave_init()</a> to configure the SPI slave hardware settings.</li>
<li>Step 4. Call <a class="el" href="group___s_p_i___s_l_a_v_e.html#gae9533bf2fe55540dc4ac1daa0bbd1e86" title="This function registers user's callback in the SPI slave driver. ">hal_spi_slave_register_callback()</a> to register a user callback.</li>
<li>An example implementation of the SPI slave. <div class="fragment"><div class="line"><a class="code" href="structhal__spi__slave__config__t.html">hal_spi_slave_config_t</a> spi_configure;</div><div class="line">spi_configure.<a class="code" href="structhal__spi__slave__config__t.html#a2cce0ed88ee3d7e72349a47474c5de88">phase</a> = <a class="code" href="group__hal__spi__slave__enum.html#gga34434dca1239d3d67933d3c44d50ea81a6610f1f8b0059fc6ba6838ed8dc708df">HAL_SPI_SLAVE_CLOCK_PHASE0</a>;</div><div class="line">spi_configure.<a class="code" href="structhal__spi__slave__config__t.html#ab8ea10cc1684cfb684f2054dfed7f157">polarity</a> = <a class="code" href="group__hal__spi__slave__enum.html#gga8c4d9cf35bae2e860a899a7ef2fb3846a2cc9b475bf12d5cfae1e2da6ad1cbf41">HAL_SPI_SLAVE_CLOCK_POLARITY0</a>;</div><div class="line"></div><div class="line"><span class="comment">// Initialize the GPIO, set the GPIO pinmux, if it wasn't configured by the EPT tool.</span></div><div class="line"><a class="code" href="group___g_p_i_o.html#ga19985c2e5d4b22d47d08103be800331d">hal_gpio_init</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daa994758bb09d6f7bcf29834a7d4a92292">HAL_GPIO_29</a>);</div><div class="line"><a class="code" href="group___g_p_i_o.html#ga19985c2e5d4b22d47d08103be800331d">hal_gpio_init</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daa0073633ba5485b15bb1b52e7bd42f3c9">HAL_GPIO_30</a>);</div><div class="line"><a class="code" href="group___g_p_i_o.html#ga19985c2e5d4b22d47d08103be800331d">hal_gpio_init</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daaf8769f3496e6ddfda14390da15c4b3f7">HAL_GPIO_31</a>);</div><div class="line"><a class="code" href="group___g_p_i_o.html#ga19985c2e5d4b22d47d08103be800331d">hal_gpio_init</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daa14dc83127632a2dc48f7f5be073237cc">HAL_GPIO_32</a>);</div><div class="line"></div><div class="line"><span class="comment">// Call #hal_pinmux_set_function() to set the GPIO pinmux. For more information, please refer to hal_pinmux_define.h.</span></div><div class="line"><span class="comment">// No need to configure the pinmux, if EPT tool is used.</span></div><div class="line"><span class="comment">//function_index = HAL_GPIO_29_SPI_MOSI_S_CM4.</span></div><div class="line"><a class="code" href="group___g_p_i_o.html#ga54dd22211d970fb607bf172a71dca723">hal_pinmux_set_function</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daa994758bb09d6f7bcf29834a7d4a92292">HAL_GPIO_29</a>, function_index);<span class="comment">// No need to configure the pinmux, if EPT tool is used.</span></div><div class="line"><span class="comment">//function_index = HAL_GPIO_30_SPI_MISO_S_CM4.</span></div><div class="line"><a class="code" href="group___g_p_i_o.html#ga54dd22211d970fb607bf172a71dca723">hal_pinmux_set_function</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daa0073633ba5485b15bb1b52e7bd42f3c9">HAL_GPIO_30</a>, function_index);<span class="comment">// No need to configure the pinmux, if EPT tool is used.</span></div><div class="line"><span class="comment">//function_index = HAL_GPIO_31_SPI_SCK_S_CM4.</span></div><div class="line"><a class="code" href="group___g_p_i_o.html#ga54dd22211d970fb607bf172a71dca723">hal_pinmux_set_function</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daaf8769f3496e6ddfda14390da15c4b3f7">HAL_GPIO_31</a>, function_index); <span class="comment">// No need to configure the pinmux, if EPT tool is used.</span></div><div class="line"><span class="comment">//function_index = HAL_GPIO_32_SPI_CS_0_S_CM4.</span></div><div class="line"><a class="code" href="group___g_p_i_o.html#ga54dd22211d970fb607bf172a71dca723">hal_pinmux_set_function</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daa14dc83127632a2dc48f7f5be073237cc">HAL_GPIO_32</a>, function_index);<span class="comment">// No need to configure the pinmux, if EPT tool is used.</span></div><div class="line"></div><div class="line">ret_status = <a class="code" href="group___s_p_i___s_l_a_v_e.html#gaa977b5ad2693071802c52bbda5a7898d">hal_spi_slave_init</a>(<a class="code" href="group__hal__spi__slave__enum.html#ggadcabf6f9919f35026e7a9d7162000a6fad81d76145fa62c0b89725dfccd4d2e6f">HAL_SPI_SLAVE_0</a>, &spi_configure);</div><div class="line"><a class="code" href="group___s_p_i___s_l_a_v_e.html#gae9533bf2fe55540dc4ac1daa0bbd1e86">hal_spi_slave_register_callback</a>(<a class="code" href="group__hal__spi__slave__enum.html#ggadcabf6f9919f35026e7a9d7162000a6fad81d76145fa62c0b89725dfccd4d2e6f">HAL_SPI_SLAVE_0</a>,user_spi_callback,NULL)<span class="comment">// Register a user callback.</span></div></div><!-- fragment --></li>
</ul>
<h1><a class="anchor" id="HAL_SPI_SLAVE_Pin_Driving_Adjust_Guide_Chapter"></a>
How to adjust the driving current of the SPI master.</h1>
<p>When the SPI slave is operating on high frequency clock and the hardware environment is not well designed, the SPI slave may malfunction because of bad signal integrity. Use an oscilloscope to find out which pin requires an adjustment. Normally it'll be the data pin. Then the user can adjust the driving current of a specific SPI pin by calling #hal_gpio_set_driving().</p><ul>
<li>sample code: <div class="fragment"><div class="line"><span class="comment">// To adjust the MISO pin (corresponds to GPIO26) of the SPI slave, call #hal_gpio_init(),</span></div><div class="line"><span class="comment">// then #hal_pinmux_set_function() to initialize this SPI pin.</span></div><div class="line"><a class="code" href="group___g_p_i_o.html#ga19985c2e5d4b22d47d08103be800331d">hal_gpio_init</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daac920829237cdc41b9004216595196703">HAL_GPIO_26</a>);</div><div class="line"><a class="code" href="group___g_p_i_o.html#ga54dd22211d970fb607bf172a71dca723">hal_pinmux_set_function</a>(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daac920829237cdc41b9004216595196703">HAL_GPIO_26</a>, SPIS_PIN_FUNC_MISO);</div><div class="line"><span class="comment">// Then call #hal_gpio_set_driving() to set the proper driving current for this SPI pin.</span></div><div class="line">hal_gpio_set_driving(<a class="code" href="group__hal__gpio__enum.html#gga8793dd0b4f544f610264c026357bf6daac920829237cdc41b9004216595196703">HAL_GPIO_26</a>, HAL_GPIO_DRIVING_8MA);</div><div class="line"><span class="comment">// Call #hal_spi_slave_init() to initialize the SPI slave.</span></div><div class="line"><a class="code" href="group___s_p_i___s_l_a_v_e.html#gaa977b5ad2693071802c52bbda5a7898d">hal_spi_slave_init</a>(<a class="code" href="group__hal__spi__slave__enum.html#ggadcabf6f9919f35026e7a9d7162000a6fad81d76145fa62c0b89725dfccd4d2e6f">HAL_SPI_SLAVE_0</a> ,&spi_config);</div></div><!-- fragment --> </li>
</ul>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaa977b5ad2693071802c52bbda5a7898d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__hal__spi__slave__enum.html#gacd02b20fc0426d288f0788484ab5c96a">hal_spi_slave_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___s_p_i___s_l_a_v_e.html#gaa977b5ad2693071802c52bbda5a7898d">hal_spi_slave_init</a> (<a class="el" href="group__hal__spi__slave__enum.html#gadcabf6f9919f35026e7a9d7162000a6f">hal_spi_slave_port_t</a> spi_port, <a class="el" href="structhal__spi__slave__config__t.html">hal_spi_slave_config_t</a> *spi_configure)</td></tr>
<tr class="memdesc:gaa977b5ad2693071802c52bbda5a7898d"><td class="mdescLeft"> </td><td class="mdescRight">This function initializes the SPI slave and sets user defined common parameters including clock polarity and clock phase, always setup internal configuration for 20MHz SPI clock for better throughput. <a href="#gaa977b5ad2693071802c52bbda5a7898d">More...</a><br /></td></tr>
<tr class="separator:gaa977b5ad2693071802c52bbda5a7898d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gae9533bf2fe55540dc4ac1daa0bbd1e86"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__hal__spi__slave__enum.html#gacd02b20fc0426d288f0788484ab5c96a">hal_spi_slave_status_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___s_p_i___s_l_a_v_e.html#gae9533bf2fe55540dc4ac1daa0bbd1e86">hal_spi_slave_register_callback</a> (<a class="el" href="group__hal__spi__slave__enum.html#gadcabf6f9919f35026e7a9d7162000a6f">hal_spi_slave_port_t</a> spi_port, <a class="el" href="group__hal__spi__slave__typedef.html#ga7d88c969ce246f453fce08fdb10f4f36">hal_spi_slave_callback_t</a> callback_function, void *user_data)</td></tr>
<tr class="memdesc:gae9533bf2fe55540dc4ac1daa0bbd1e86"><td class="mdescLeft"> </td><td class="mdescRight">This function registers user's callback in the SPI slave driver. <a href="#gae9533bf2fe55540dc4ac1daa0bbd1e86">More...</a><br /></td></tr>
<tr class="separator:gae9533bf2fe55540dc4ac1daa0bbd1e86"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
Modules</h2></td></tr>
<tr class="memitem:group__hal__spi__slave__enum"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hal__spi__slave__enum.html">Enum</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:group__hal__spi__slave__struct"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hal__spi__slave__struct.html">Struct</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:group__hal__spi__slave__typedef"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__hal__spi__slave__typedef.html">Typedef</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gaa977b5ad2693071802c52bbda5a7898d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__hal__spi__slave__enum.html#gacd02b20fc0426d288f0788484ab5c96a">hal_spi_slave_status_t</a> hal_spi_slave_init </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__hal__spi__slave__enum.html#gadcabf6f9919f35026e7a9d7162000a6f">hal_spi_slave_port_t</a> </td>
<td class="paramname"><em>spi_port</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structhal__spi__slave__config__t.html">hal_spi_slave_config_t</a> * </td>
<td class="paramname"><em>spi_configure</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function initializes the SPI slave and sets user defined common parameters including clock polarity and clock phase, always setup internal configuration for 20MHz SPI clock for better throughput. </p>
<p>Note that the SPI slave supports only MSB bit order and can't be config to LSB bit order. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">spi_port</td><td>is the SPI slave port number, the value is defined at <a class="el" href="group__hal__spi__slave__enum.html#gadcabf6f9919f35026e7a9d7162000a6f" title="This enum defines the SPI slave port. ">hal_spi_slave_port_t</a>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">spi_configure</td><td>is the SPI slave configure parameters. Details are described at <a class="el" href="structhal__spi__slave__config__t.html" title="SPI slave configure. ">hal_spi_slave_config_t</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__hal__spi__slave__enum.html#ggacd02b20fc0426d288f0788484ab5c96aa5d1338fdd243dd0d270c4ed38cc2d173" title="Invalid SPI slave port number. ">HAL_SPI_SLAVE_STATUS_ERROR_PORT</a>, if the SPI slave port is invalid. <br />
<a class="el" href="group__hal__spi__slave__enum.html#ggacd02b20fc0426d288f0788484ab5c96aa80fd60b5cbd3b5516813cda81ffc6d80" title="Invalid parameter. ">HAL_SPI_SLAVE_STATUS_INVALID_PARAMETER</a>, if an invalid parameter is given by user. <br />
<a class="el" href="group__hal__spi__slave__enum.html#ggacd02b20fc0426d288f0788484ab5c96aa3e525d05a72280ee0bfe3e284e1bbc2f" title="The SPI slave API call was successful. ">HAL_SPI_SLAVE_STATUS_OK</a>, if this function returned successfully. </dd></dl>
</div>
</div>
<a class="anchor" id="gae9533bf2fe55540dc4ac1daa0bbd1e86"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__hal__spi__slave__enum.html#gacd02b20fc0426d288f0788484ab5c96a">hal_spi_slave_status_t</a> hal_spi_slave_register_callback </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__hal__spi__slave__enum.html#gadcabf6f9919f35026e7a9d7162000a6f">hal_spi_slave_port_t</a> </td>
<td class="paramname"><em>spi_port</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__hal__spi__slave__typedef.html#ga7d88c969ce246f453fce08fdb10f4f36">hal_spi_slave_callback_t</a> </td>
<td class="paramname"><em>callback_function</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"><em>user_data</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function registers user's callback in the SPI slave driver. </p>
<p>This function may be called when using the SPI slave driver, the callback will be called in SPI interrupt service routine. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">spi_port</td><td>is the SPI slave port number, the value is defined at <a class="el" href="group__hal__spi__slave__enum.html#gadcabf6f9919f35026e7a9d7162000a6f" title="This enum defines the SPI slave port. ">hal_spi_slave_port_t</a>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback_function</td><td>is the callback function given by user, which will be called at SPI slave interrupt service routine. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">user_data</td><td>is a parameter given by user and will pass to user while the callback function is called. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__hal__spi__slave__enum.html#ggacd02b20fc0426d288f0788484ab5c96aa5d1338fdd243dd0d270c4ed38cc2d173" title="Invalid SPI slave port number. ">HAL_SPI_SLAVE_STATUS_ERROR_PORT</a>, if the SPI slave port is invalid. <br />
<a class="el" href="group__hal__spi__slave__enum.html#ggacd02b20fc0426d288f0788484ab5c96aa80fd60b5cbd3b5516813cda81ffc6d80" title="Invalid parameter. ">HAL_SPI_SLAVE_STATUS_INVALID_PARAMETER</a>, if an invalid parameter is given by user. <br />
<a class="el" href="group__hal__spi__slave__enum.html#ggacd02b20fc0426d288f0788484ab5c96aa3e525d05a72280ee0bfe3e284e1bbc2f" title="The SPI slave API call was successful. ">HAL_SPI_SLAVE_STATUS_OK</a>, if this function returned successfully. </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Wed Nov 15 2017 19:29:18 for MT7697 API Reference by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
<!-- Mirrored from labs.mediatek.com/api/mt7697/group___s_p_i___s_l_a_v_e.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 18 Aug 2021 07:12:57 GMT -->
</html>
| 89.969945 | 4,922 | 0.732242 |
82b440ae5056ce0bd63464f3f500ec22757bbbc4 | 10,371 | sql | SQL | egov/egov-bpa/src/main/resources/db/migration/main/V20180826170903__bpa_dcr_checklist.sql | cscl-git/digit-bpa | bcf2a4f0dadcee3d636357c51350db96071b40c6 | [
"MIT"
] | null | null | null | egov/egov-bpa/src/main/resources/db/migration/main/V20180826170903__bpa_dcr_checklist.sql | cscl-git/digit-bpa | bcf2a4f0dadcee3d636357c51350db96071b40c6 | [
"MIT"
] | null | null | null | egov/egov-bpa/src/main/resources/db/migration/main/V20180826170903__bpa_dcr_checklist.sql | cscl-git/digit-bpa | bcf2a4f0dadcee3d636357c51350db96071b40c6 | [
"MIT"
] | null | null | null | insert into EGBPA_MSTR_CHECKLIST(id,checklisttype,servicetype,version,createdBy,createdDate)
values(nextval('SEQ_EGBPA_MSTR_CHECKLIST'),'BPADCRDOCUMENTS', (select id from egbpa_mstr_servicetype where description='Demolition'),
0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-11','Site Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Demolition')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-12','Service Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Demolition')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-13','Building Plan',
true,true,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Demolition')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-14','Parking Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Demolition')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-15','Terrace Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Demolition')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-16','Others',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Demolition')), 0,1,now());
insert into EGBPA_MSTR_CHECKLIST(id,checklisttype,servicetype,version,createdBy,createdDate)
values(nextval('SEQ_EGBPA_MSTR_CHECKLIST'),'BPADCRDOCUMENTS', (select id from egbpa_mstr_servicetype where description='Reconstruction'),
0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-21','Site Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Reconstruction')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-22','Service Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Reconstruction')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-23','Building Plan',
true,true,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Reconstruction')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-24','Parking Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Reconstruction')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-25','Terrace Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Reconstruction')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-26','Others',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Reconstruction')), 0,1,now());
insert into EGBPA_MSTR_CHECKLIST(id,checklisttype,servicetype,version,createdBy,createdDate)
values(nextval('SEQ_EGBPA_MSTR_CHECKLIST'),'BPADCRDOCUMENTS', (select id from egbpa_mstr_servicetype where description='Alteration'),
0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-31','Site Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Alteration')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-32','Service Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Alteration')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-33','Building Plan',
true,true,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Alteration')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-34','Parking Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Alteration')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-35','Terrace Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Alteration')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-36','Others',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Alteration')), 0,1,now());
insert into EGBPA_MSTR_CHECKLIST(id,checklisttype,servicetype,version,createdBy,createdDate)
values(nextval('SEQ_EGBPA_MSTR_CHECKLIST'),'BPADCRDOCUMENTS', (select id from egbpa_mstr_servicetype where description='Change in occupancy'),
0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-41','Site Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Change in occupancy')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-42','Service Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Change in occupancy')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-43','Building Plan',
true,true,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Change in occupancy')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-44','Parking Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Change in occupancy')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-45','Terrace Plan',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Change in occupancy')), 0,1,now());
insert into EGBPA_MSTR_CHKLISTDETAIL (id ,code,description,isactive,ismandatory,checklist,version,createdBy,createdDate)
values((nextval('SEQ_EGBPA_MSTR_CHKLISTDETAIL')),'DCR-46','Others',
true,false,(select id from EGBPA_MSTR_CHECKLIST where checklisttype='BPADCRDOCUMENTS'
and servicetype= (select id from egbpa_mstr_servicetype where description='Change in occupancy')), 0,1,now());
| 74.611511 | 143 | 0.812747 |
607870bb5bfe480301bbff8f8fd694739dbabaa2 | 8,983 | dart | Dart | lib/ui/loginPage.dart | dangviettuan/OBP-Onboarding-Flutter | 6a76a4eadeee0fb9a2e019e9f84b5a4d4c569a70 | [
"BSD-3-Clause"
] | 4 | 2020-11-16T13:09:23.000Z | 2021-01-17T14:27:18.000Z | lib/ui/loginPage.dart | dangviettuan/OBP-Onboarding-Flutter | 6a76a4eadeee0fb9a2e019e9f84b5a4d4c569a70 | [
"BSD-3-Clause"
] | null | null | null | lib/ui/loginPage.dart | dangviettuan/OBP-Onboarding-Flutter | 6a76a4eadeee0fb9a2e019e9f84b5a4d4c569a70 | [
"BSD-3-Clause"
] | 1 | 2020-10-06T06:07:13.000Z | 2020-10-06T06:07:13.000Z | import 'package:community_material_icon/community_material_icon.dart';
import 'package:flutter/material.dart';
import 'package:flutter_auth_buttons/flutter_auth_buttons.dart';
import 'package:hello_obp_flutter/model/model.dart';
import 'package:hello_obp_flutter/utils/auth.dart';
import 'package:loading_overlay/loading_overlay.dart';
typedef LoginCallback = void Function(User user);
class LoginPage extends StatefulWidget {
final VoidCallback loginFun;
LoginPage(this.loginFun, {key}) : super(key: key);
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
final formKey = GlobalKey<FormState>();
String _userName;
String _password;
// manage state of modal progress HUD widget
bool _isLoading = false;
bool validateAndSave() {
final form = formKey.currentState;
if (form.validate()) {
form.save();
return true;
}
return false;
}
void validateAndSubmit(BuildContext context) async {
if (validateAndSave()) {
try {
setState(() {
this._isLoading = true;
});
User user = await auth.signInWithUserNameAndPassword(
_userName, _password);
if (user != null) {
// dismiss keyboard during async call
FocusScope.of(context).requestFocus(FocusNode());
this.widget.loginFun();
} else {
Scaffold.of(context).showSnackBar(SnackBar(
content: ListTile(leading: Icon(
Icons.warning,
color: Colors.yellow,
),
title: Text('Incorrect User name or password!'),
)));
}
} catch (e) {
print('Error: $e');
Scaffold.of(context).showSnackBar(SnackBar(
content: ListTile(leading: Icon(
Icons.warning,
color: Colors.yellow,
),
title: Text('Login fail, for server side error!'),
)));
} finally {
setState(() {
this._isLoading = false;
});
}
}
}
void googleLogin(BuildContext context) async {
try {
setState(() {
this._isLoading = true;
});
User user = await auth.sinInWithGoogle();
if (user != null) {
this.widget.loginFun();
} else {
Scaffold.of(context).showSnackBar(SnackBar(
content: ListTile(leading: Icon(
Icons.warning,
color: Colors.yellow,
),
title: Text('Login fail, for server side error! Please retry.'),
)
));
}
} finally {
setState(() {
this._isLoading = false;
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: LoadingOverlay(
isLoading: _isLoading,
// demo of some additional parameters
opacity: 0.5,
progressIndicator: CircularProgressIndicator(),
child: Builder(
builder: (context) => SingleChildScrollView(
child: Form(
key: formKey,
child: Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 120.0),
child: Container(
alignment: Alignment.center,
child: Container(
child: Image.asset('assets/img/logo.png',
fit: BoxFit.fill),
),
),
),
SizedBox(
height: 24.0,
),
Text(
"Onboarding",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.green, fontSize: 24.0),
),
SizedBox(
height: 24.0,
),
Padding(
padding:
EdgeInsets.only(top: 26.0, left: 42.0, right: 42.0),
child: Container(
width: double.infinity,
height: 140.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(4.0),
),
border:
Border.all(color: Color(0xFFF1F1F1), width: 1),
),
child: Column(
children: <Widget>[
Expanded(
flex: 1,
child: Padding(
padding:
EdgeInsets.only(left: 18.0, bottom: 6.0),
child: Container(
alignment: Alignment.bottomLeft,
child: TextFormField(
decoration: InputDecoration(
labelText: 'User Name',
border: InputBorder.none,
),
validator: (value) => value.isEmpty
? 'UserName can\'t be empty'
: null,
onSaved: (value) => _userName = value,
),
),
),
),
Divider(
thickness: 1,
indent: 16.0,
endIndent: 16.0,
height: 1,
),
Expanded(
flex: 1,
child: Padding(
padding:
EdgeInsets.only(left: 18.0, bottom: 6.0),
child: Container(
alignment: Alignment.bottomLeft,
child: TextFormField(
decoration: InputDecoration(
labelText: 'Password',
border: InputBorder.none,
),
obscureText: true,
validator: (value) => value.isEmpty
? 'Password can\'t be empty'
: null,
onSaved: (value) => _password = value,
),
),
),
)
],
),
),
),
Padding(
padding: EdgeInsets.only(
left: 42.0,
right: 42.0,
top: 32.0,
),
child: Row(
children: <Widget>[
Expanded(
child: RaisedButton(
child: Text(
"Login",
style: TextStyle(fontSize: 18),
),
textColor: Colors.white,
color: Colors.green,
onPressed: () => this.validateAndSubmit(context),
)),
],
),
),
Padding(
padding: const EdgeInsets.only(top: 10.0),
child: Center(
child: Text(
'- Or -',
style: TextStyle(fontSize: 18),
),
),
),
GoogleSignInButton(
textStyle: TextStyle(fontSize: 15, color: Colors.white),
splashColor: Colors.green,
onPressed: () => this.googleLogin(context),
darkMode: true, // default: false
)
],
),
),
),
),
),
),
);
}
}
| 35.646825 | 78 | 0.385395 |
76fcb5b065e378eb2a38669d3073579d8ca3f720 | 1,307 | dart | Dart | lib/apps/models/services_model.dart | mesabo/recuchapadmin | 237bee2f0b51dae45a173966ae9b9b7ce8b1273c | [
"MIT"
] | 1 | 2021-07-24T22:10:59.000Z | 2021-07-24T22:10:59.000Z | lib/apps/models/services_model.dart | mesabo/recuchapadmin | 237bee2f0b51dae45a173966ae9b9b7ce8b1273c | [
"MIT"
] | null | null | null | lib/apps/models/services_model.dart | mesabo/recuchapadmin | 237bee2f0b51dae45a173966ae9b9b7ce8b1273c | [
"MIT"
] | null | null | null | class ServicesModel {
final int id;
final String title;
final double price;
final int duration;
final String description;
final String createdat;
final String updatedat;
final String inprogresss;
ServicesModel({
this.id = 0,
this.title = '',
this.price = 0,
this.duration = 0,
this.description = '',
this.createdat = '',
this.updatedat = '',
this.inprogresss = '',
});
ServicesModel.fromJsonMap(Map<String, dynamic> map)
: id = map['id'] as int,
title = map['title'] as String,
price = map['price'] as double,
duration = map['duration'] as int,
description = map['description'] as String,
createdat = map['created_at'] as String,
updatedat = map['updated_at'] as String,
inprogresss = map['inprogresss'] as String;
Map<String, dynamic> toJsonMap() => {
'id': id,
'title': title,
'price': price,
'duration': duration,
'description': description,
'created_at': updatedat,
'updated_at': updatedat,
'inprogresss': inprogresss
};
@override
String toString() {
return '{ ${this.id},${this.title},${this.price},${this.duration},${this.description},${this.createdat},${this.updatedat},${this.inprogresss},}';
}
}
| 27.229167 | 149 | 0.598317 |
14247d2cbd53419d4552843addb555f6431792dd | 1,463 | dart | Dart | lib/controllers/clients_controller.dart | aittataa/shifaa_pharmacy | 679a10decbcfae40dc669aae39f08fbfba724191 | [
"MIT"
] | null | null | null | lib/controllers/clients_controller.dart | aittataa/shifaa_pharmacy | 679a10decbcfae40dc669aae39f08fbfba724191 | [
"MIT"
] | null | null | null | lib/controllers/clients_controller.dart | aittataa/shifaa_pharmacy | 679a10decbcfae40dc669aae39f08fbfba724191 | [
"MIT"
] | null | null | null | import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shifaa_pharmacy/classes/client.dart';
import 'package:shifaa_pharmacy/constant/constant.dart';
import 'package:shifaa_pharmacy/constant/shared_functions.dart';
import 'package:shifaa_pharmacy/provider/database_provider.dart';
class ClientsController extends GetxController {
var myClientsList = <Client>[].obs;
var signInClient = Client().obs;
@override
void onInit() {
load;
super.onInit();
}
get load async {
var myList = await DataBaseProvider.getAllClients;
if (myList != null) myClientsList.value = myList;
update();
}
get clear async {
final session = await SharedPreferences.getInstance();
session.clear();
Constant.signInClient = null;
bool state = SharedFunctions.isClientLogged;
print(state);
}
getClientByID(int id) async {
return await DataBaseProvider.getClientByID(id);
}
getClientByInfo(Client client) async {
return await DataBaseProvider.getClientByInfo(client);
}
addNewClient(Client client) async {
bool state = await DataBaseProvider.addNewClient(client);
return state;
}
updateClientInfo(Client client) async {
bool state = await DataBaseProvider.updateClientInfo(client);
return state;
}
updateClientAddress(Client client) async {
bool state = await DataBaseProvider.updateClientAddress(client);
return state;
}
}
| 26.6 | 68 | 0.736159 |
db79db587d6f46482295887daa4f2beb1508e0b4 | 1,259 | swift | Swift | packages/expo-modules-core/ios/Swift/Logging/LogType.swift | ryo-rm/expo | 0c398d104ae125cc9fbe96826fd5c22802914a86 | [
"MIT"
] | null | null | null | packages/expo-modules-core/ios/Swift/Logging/LogType.swift | ryo-rm/expo | 0c398d104ae125cc9fbe96826fd5c22802914a86 | [
"MIT"
] | null | null | null | packages/expo-modules-core/ios/Swift/Logging/LogType.swift | ryo-rm/expo | 0c398d104ae125cc9fbe96826fd5c22802914a86 | [
"MIT"
] | null | null | null | // Copyright 2022-present 650 Industries. All rights reserved.
import os.log
/**
An enum with available log types.
*/
public enum LogType: Int {
case trace = 0
case timer = 1
case stacktrace = 2
case debug = 3
case info = 4
case warn = 5
case error = 6
case fatal = 7
/**
The string that is used to prefix the messages of this log type.
Logs in Xcode and Console apps are always with the white text,
so we use colored circle emojis to distinguish different types of logs.
*/
var prefix: String {
switch self {
case .trace:
return "⚪️"
case .timer:
return "🟤"
case .stacktrace:
return "🟣"
case .debug:
return "🔵"
case .info:
return "🟢"
case .warn:
return "🟡"
case .error:
return "🟠"
case .fatal:
return "🔴"
}
}
/**
Maps the log types to the log types used by the `os.log` logger.
*/
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
func toOSLogType() -> OSLogType {
switch self {
case .trace, .timer, .stacktrace, .debug:
return .debug
case .info:
return .info
case .warn:
return .default
case .error:
return .error
case .fatal:
return .fault
}
}
}
| 19.984127 | 74 | 0.586974 |
f09160d855f04d8889f31b7ec77eb4021cbc2da8 | 1,434 | js | JavaScript | src/api/sampleData.js | ChariotDigital/Lancet | 83537ef5c0c096473bb8830c2926ba1da3e96835 | [
"MIT"
] | 1 | 2022-03-30T18:56:13.000Z | 2022-03-30T18:56:13.000Z | src/api/sampleData.js | ChariotDigital/Lancet | 83537ef5c0c096473bb8830c2926ba1da3e96835 | [
"MIT"
] | null | null | null | src/api/sampleData.js | ChariotDigital/Lancet | 83537ef5c0c096473bb8830c2926ba1da3e96835 | [
"MIT"
] | null | null | null | export const defaultCategories = [
{ value: "Web Development", label: "Web Development" },
{ value: "Web Design", label: "Web Design" },
{ value: "Digital Art", label: "Digital Art" },
{ value: "Social Media Marketing", label: "Social Media Marketing" },
{ value: "Project Management" , label: "Project Management" },
{ value: "Community Management", label: "Community Management" },
];
export const defaultSkills = [
{value: "react", label: "React"},
{value: "node.js", label: "Node.js"},
{value: "nft art", label: "NFT Art"},
{value: "Product Management", label: "Product Mangement"},
{value: "Digital Marketing", label: "Digital Marketing"},
,
]
export const defaultScope = [
{ value: "One-Time", label: "One-Time" },
{ value: "Hourly", label: "Hourly" },
{ value: "Fixed Time", label: "Fixed Time" }
]
export const defaultProfessions = [
{ value: "Engineer", label: "Engineer" },
{ value: "UI/UX Desginer", label: "UI/UX Desginer" },
{ value: "Artist", label: "Artist" },
{ value: "Writer", label: "Writer" },
{ value: "Project Manager", label: "Project Manager" },
{ value: "Marketer", label: "Marketer" },
];
export const defaultSocials = [
{ value: "", label: "Twitter" },
{ value: "", label: "Facebook" },
{ value: "", label: "Discord" },
{ value: "", label: "LinkedIn" },
{ value: "", label: "Medium" },
];
| 34.97561 | 73 | 0.588563 |
047f31983ba79d6b11295d20789a66924ed38601 | 1,990 | java | Java | holidaysomething/src/test/java/com/holidaysomething/holidaysomething/JDragon/repositoryTest/ProductCategoryTest.java | gyumin-kim/Holiday-something | 0fcb6c7a2fedf70fec3ad06933997109b101cabc | [
"MIT"
] | 24 | 2018-12-04T09:30:41.000Z | 2021-07-27T01:29:25.000Z | holidaysomething/src/test/java/com/holidaysomething/holidaysomething/JDragon/repositoryTest/ProductCategoryTest.java | gyumin-kim/Holiday-something | 0fcb6c7a2fedf70fec3ad06933997109b101cabc | [
"MIT"
] | 6 | 2018-12-10T05:00:02.000Z | 2019-01-28T06:33:07.000Z | holidaysomething/src/test/java/com/holidaysomething/holidaysomething/JDragon/repositoryTest/ProductCategoryTest.java | gyumin-kim/Holiday-something | 0fcb6c7a2fedf70fec3ad06933997109b101cabc | [
"MIT"
] | 9 | 2018-12-20T09:10:16.000Z | 2020-12-23T07:35:19.000Z | package com.holidaysomething.holidaysomething.JDragon.repositoryTest;
import com.holidaysomething.holidaysomething.domain.ProductCategory;
import com.holidaysomething.holidaysomething.dto.ProductListCategoryDto;
import com.holidaysomething.holidaysomething.repository.ProductCategoryRepository;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringRunner.class)
@DataJpaTest
@Transactional
public class ProductCategoryTest {
private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager
.getLogger(ProductCategoryTest.class);
@Autowired
ProductCategoryRepository productCategoryRepository;
@Test
public void 카테고리전체읽어와버리기() {
List<ProductCategory> categories = productCategoryRepository.findAll();
for (ProductCategory pc : categories) {
log.info(pc.getName());
}
}
@Test
public void 카테고리읽어와버리기() {
List<ProductCategory> categories = productCategoryRepository.findCategory(0l);
for (ProductCategory pc : categories) {
log.info(pc.getName());
}
}
// 소분류 아이디를 이용해 대분류 중분류 구하기.
@Test
public void 대중분류카테고리읽어오기() {
ProductListCategoryDto category = productCategoryRepository.findProductCategories(42l);
log.info("====== parent_id : " + category.getParentId() + " parent_name : " + category
.getParentName()
+ " child_id : " + category.getChildId() + " child_name : " + category.getChildName());
}
// 중분류 아이디를 이용해 대분류 구하기
@Test
public void 대분류카테고리읽어오기() {
ProductCategory category = productCategoryRepository.findProductBigCategory(37l);
log.info("====== parent_id : " + category.getId() + " parent_name : " + category.getName());
}
}
| 33.166667 | 99 | 0.750754 |
acda4164065740ff6f20abc432ef313b7414be57 | 2,623 | sql | SQL | CMSDataScripts/dbo/Stored Procedures/carrot_BlogDateFilenameUpdate.sql | ninianne98/CarrotCakeCMS-MVC | 6f00c2d2e46cfe33fd49311f3569cea65002e8e4 | [
"MIT"
] | 29 | 2015-09-24T03:17:25.000Z | 2020-05-07T01:01:40.000Z | CMSDataScripts/dbo/Stored Procedures/carrot_BlogDateFilenameUpdate.sql | ninianne98/CarrotCakeCMS-MVC | 6f00c2d2e46cfe33fd49311f3569cea65002e8e4 | [
"MIT"
] | 3 | 2016-01-10T17:30:02.000Z | 2019-09-10T17:26:09.000Z | CMSDataScripts/dbo/Stored Procedures/carrot_BlogDateFilenameUpdate.sql | ninianne98/CarrotCakeCMS-MVC | 6f00c2d2e46cfe33fd49311f3569cea65002e8e4 | [
"MIT"
] | 21 | 2015-10-21T14:44:10.000Z | 2022-02-01T10:08:43.000Z |
CREATE PROCEDURE [dbo].[carrot_BlogDateFilenameUpdate]
@SiteID uniqueidentifier
/*
exec [carrot_BlogDateFilenameUpdate] '3BD253EA-AC65-4EB6-A4E7-BB097C2255A0'
*/
AS BEGIN
SET NOCOUNT ON
DECLARE @ErrorCode int
SET @ErrorCode = 0
DECLARE @TranStarted bit
SET @TranStarted = 0
DECLARE @DatePattern nvarchar(50)
SELECT @DatePattern = (select top 1 ct.Blog_DatePattern from dbo.carrot_Sites (nolock) ct where ct.SiteID = @SiteID)
DECLARE @blogType uniqueidentifier
SELECT @blogType = (select top 1 ct.ContentTypeID from dbo.carrot_ContentType (nolock) ct where ct.ContentTypeValue = 'BlogEntry')
DECLARE @tblTimeSlugs TABLE(
GoLiveDateLocal datetime,
URLBase nvarchar(256)
)
insert into @tblTimeSlugs(GoLiveDateLocal)
select distinct rc.GoLiveDateLocal
from dbo.[carrot_RootContent] as rc (nolock)
where rc.SiteID = @SiteID
and rc.ContentTypeID = @blogType
IF (@DatePattern = 'yyyy/M/d' ) BEGIN
update @tblTimeSlugs
set URLBase = REPLACE(CONVERT(NVARCHAR(20), GoLiveDateLocal, 111), '/0', '/')
END
IF (@DatePattern = 'yyyy/MM' ) BEGIN
update @tblTimeSlugs
set URLBase = SUBSTRING(CONVERT(NVARCHAR(20), GoLiveDateLocal, 111), 1, 7)
END
IF (@DatePattern = 'yyyy/MMMM' ) BEGIN
update @tblTimeSlugs
set URLBase = CAST(YEAR(GoLiveDateLocal) as nvarchar(20)) +'/'+ DATENAME(MONTH, GoLiveDateLocal)
END
IF (@DatePattern = 'yyyy' ) BEGIN
update @tblTimeSlugs
set URLBase = CAST(YEAR(GoLiveDateLocal) as nvarchar(20))
END
IF (ISNULL(@DatePattern, 'yyyy/MM/dd') = 'yyyy/MM/dd' )
OR EXISTS(select * from @tblTimeSlugs where URLBase is null or len(URLBase) < 1) BEGIN
update @tblTimeSlugs
set URLBase = CONVERT(NVARCHAR(20), GoLiveDateLocal, 111)
END
IF ( @@TRANCOUNT = 0 ) BEGIN
BEGIN TRANSACTION
SET @TranStarted = 1
END ELSE
SET @TranStarted = 0
update rc
set [FileName] = replace('/'+ s.URLBase +'/' + ISNULL(rc.PageSlug, cast(Root_ContentID as nvarchar(64))) , '//','/')
from dbo.[carrot_RootContent] rc
join @tblTimeSlugs s on rc.GoLiveDateLocal = s.GoLiveDateLocal
where rc.SiteID = @SiteID
AND rc.ContentTypeID = @blogType
IF ( @@ERROR <> 0 ) BEGIN
SET @ErrorCode = -1
GOTO Cleanup
END
IF ( @TranStarted = 1 ) BEGIN
SET @TranStarted = 0
COMMIT TRANSACTION
END
RETURN(0)
Cleanup:
IF ( @TranStarted = 1 ) BEGIN
SET @TranStarted = 0
ROLLBACK TRANSACTION
END
RETURN @ErrorCode
END | 26.494949 | 133 | 0.654975 |
8f086ba6756e6069f34fba98666d1d30aefeb802 | 2,416 | java | Java | Client/src/com/jagex/Class526_Sub38_Sub3.java | dylan-worth/OfflineRS | 7d217a1de621e65effffe84b208f7a5537536b2d | [
"Apache-2.0"
] | null | null | null | Client/src/com/jagex/Class526_Sub38_Sub3.java | dylan-worth/OfflineRS | 7d217a1de621e65effffe84b208f7a5537536b2d | [
"Apache-2.0"
] | null | null | null | Client/src/com/jagex/Class526_Sub38_Sub3.java | dylan-worth/OfflineRS | 7d217a1de621e65effffe84b208f7a5537536b2d | [
"Apache-2.0"
] | null | null | null | package com.jagex;
import com.jagex.Class526_Sub38;
import com.jagex.Class581;
import com.jagex.Class639_Sub1_Sub2_Sub1_Sub1;
import com.jagex.Class662;
import com.jagex.client;
public class Class526_Sub38_Sub3 extends Class526_Sub38 {
int anInt11814;
public boolean method9728(int var1) {
Class639_Sub1_Sub2_Sub1_Sub1 var2 = client.aClass639_Sub1_Sub2_Sub1_Sub1Array11154[800939243 * this.anInt11814];
if(var2 != null) {
Class662.method7943(Class581.aClass581_7767, -870147923 * this.anInt10684, -1, var2, 800939243 * this.anInt11814, (short)-9374);
return true;
} else {
return false;
}
}
public Class526_Sub38_Sub3(int var1, int var2, int var3) {
super(var1, var2);
this.anInt11814 = var3 * -876319805;
}
public boolean method9730() {
Class639_Sub1_Sub2_Sub1_Sub1 var1 = client.aClass639_Sub1_Sub2_Sub1_Sub1Array11154[800939243 * this.anInt11814];
if(var1 != null) {
Class662.method7943(Class581.aClass581_7767, -870147923 * this.anInt10684, -1, var1, 800939243 * this.anInt11814, (short)2883);
return true;
} else {
return false;
}
}
public boolean method9731() {
Class639_Sub1_Sub2_Sub1_Sub1 var1 = client.aClass639_Sub1_Sub2_Sub1_Sub1Array11154[800939243 * this.anInt11814];
if(var1 != null) {
Class662.method7943(Class581.aClass581_7767, -870147923 * this.anInt10684, -1, var1, 800939243 * this.anInt11814, (short)-20478);
return true;
} else {
return false;
}
}
public boolean method9732() {
Class639_Sub1_Sub2_Sub1_Sub1 var1 = client.aClass639_Sub1_Sub2_Sub1_Sub1Array11154[800939243 * this.anInt11814];
if(var1 != null) {
Class662.method7943(Class581.aClass581_7767, -870147923 * this.anInt10684, -1, var1, 800939243 * this.anInt11814, (short)-16121);
return true;
} else {
return false;
}
}
public boolean method9729() {
Class639_Sub1_Sub2_Sub1_Sub1 var1 = client.aClass639_Sub1_Sub2_Sub1_Sub1Array11154[800939243 * this.anInt11814];
if(var1 != null) {
Class662.method7943(Class581.aClass581_7767, -870147923 * this.anInt10684, -1, var1, 800939243 * this.anInt11814, (short)-12302);
return true;
} else {
return false;
}
}
}
| 36.059701 | 139 | 0.661838 |
bb4caa489fd2fc52c901db3fb9cb0b5a99e11ea5 | 20 | asm | Assembly | src/constants/misc_constants.asm | anmart/ezgbc | 4d227bdfa48ee791cdd1ecb618b2ffd7143ed550 | [
"Unlicense"
] | 1 | 2021-10-14T21:30:05.000Z | 2021-10-14T21:30:05.000Z | src/constants/misc_constants.asm | anmart/ezgbc | 4d227bdfa48ee791cdd1ecb618b2ffd7143ed550 | [
"Unlicense"
] | 3 | 2019-09-26T15:15:33.000Z | 2019-10-29T00:59:10.000Z | src/constants/misc_constants.asm | anmart/ezgbc | 4d227bdfa48ee791cdd1ecb618b2ffd7143ed550 | [
"Unlicense"
] | null | null | null | Bankswitch EQU $30 | 20 | 20 | 0.75 |
7a7060090f217513d86acc9d2d668aa9013e315e | 19,125 | sql | SQL | icasus/install/tablas_icasus.sql | juananruiz/icasus | c186f9776a5e441ec7868d1136ca878ee1c8e11b | [
"MIT"
] | 2 | 2015-11-16T11:54:29.000Z | 2022-02-13T20:24:31.000Z | icasus/install/tablas_icasus.sql | juananruiz/icasus | c186f9776a5e441ec7868d1136ca878ee1c8e11b | [
"MIT"
] | 4 | 2018-08-27T10:58:32.000Z | 2022-02-13T20:20:35.000Z | icasus/install/tablas_icasus.sql | juananruiz/icasus | c186f9776a5e441ec7868d1136ca878ee1c8e11b | [
"MIT"
] | 2 | 2022-02-13T20:24:37.000Z | 2022-02-14T09:45:00.000Z | # ************************************************************
# Sequel Pro SQL dump
# Versión 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# ************************************************************
# Volcado de tabla icasus_analisis
# ------------------------------------------------------------
CREATE TABLE `icasus_analisis` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_indicador` int(10) unsigned NOT NULL,
`anyo` smallint(5) unsigned NOT NULL,
`analisis` text,
`plan_accion` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_carta
# ------------------------------------------------------------
CREATE TABLE `icasus_carta` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_entidad` int(11) unsigned NOT NULL,
`id_cuadro` int(11) unsigned DEFAULT NULL,
`fecha` date NOT NULL,
`mision` text,
`vision` text,
`valores` text,
`nombre` varchar(250),
`archivado` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_compromiso
# ------------------------------------------------------------
CREATE TABLE `icasus_compromiso` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_servicio` int(10) unsigned NOT NULL,
`indice` int(10) unsigned NOT NULL,
`nombre` varchar(200) NOT NULL,
`descripcion` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_compromiso_indicador
# ------------------------------------------------------------
CREATE TABLE `icasus_compromiso_indicador` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_compromiso` int(10) unsigned NOT NULL,
`id_indicador` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_criterio_efqm
# ------------------------------------------------------------
CREATE TABLE `icasus_criterio_efqm` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`codigo` varchar(10) NOT NULL DEFAULT '',
`nombre` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_criterio_efqm_indicador
# ------------------------------------------------------------
CREATE TABLE `icasus_criterio_efqm_indicador` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_criterio_efqm` int(10) unsigned DEFAULT NULL,
`id_indicador` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_cuadro
# ------------------------------------------------------------
CREATE TABLE `icasus_cuadro` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nombre` varchar(250) NOT NULL,
`id_usuario` int(11) unsigned NOT NULL,
`privado` tinyint(1) NOT NULL DEFAULT '1',
`comentarios` text CHARACTER SET utf8,
`id_entidad` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_derecho
# ------------------------------------------------------------
CREATE TABLE `icasus_derecho` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_carta` int(10) unsigned NOT NULL,
`nombre` varchar(100) CHARACTER SET latin1 NOT NULL,
`categoria` varchar(100) CHARACTER SET latin1 DEFAULT NULL,
`descripcion` text CHARACTER SET latin1,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_ejecucion
# ------------------------------------------------------------
CREATE TABLE `icasus_ejecucion` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_plan` int(10) unsigned DEFAULT NULL,
`id_linea` int(10) unsigned DEFAULT NULL,
`id_objest` int(10) unsigned DEFAULT NULL,
`id_objop` int(10) unsigned DEFAULT NULL,
`anyo` int(10) unsigned NOT NULL,
`valor` double NOT NULL,
`activo` tinyint(1) NOT NULL DEFAULT '1',
`resultado` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_entidad
# ------------------------------------------------------------
CREATE TABLE `icasus_entidad` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`orden` tinyint(4) DEFAULT NULL,
`nombre` varchar(75) NOT NULL DEFAULT '',
`etiqueta` varchar(50) NOT NULL DEFAULT '',
`etiqueta_mini` varchar(12) DEFAULT NULL,
`web` varchar(250) DEFAULT NULL,
`id_madre` int(11) unsigned NOT NULL DEFAULT '1',
`codigo` varchar(50) NOT NULL DEFAULT '',
`anotaciones` text,
`objeto` varchar(250) DEFAULT NULL,
`ict` int(1) DEFAULT NULL,
`frecuencia` varchar(250) DEFAULT NULL,
`inicio` int(11) DEFAULT NULL,
`fin` int(11) DEFAULT NULL,
`es_organica` tinyint(1) DEFAULT NULL,
`mapa` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `Index_nombre` (`nombre`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_fichero
# ------------------------------------------------------------
CREATE TABLE `icasus_fichero` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_objeto` int(11) NOT NULL,
`id_usuario` int(11) NOT NULL,
`descripcion` text,
`tipo_objeto` varchar(200) NOT NULL,
`titulo` varchar(200) NOT NULL,
`extension` varchar(4) NOT NULL,
`visible` int(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_indicador
# ------------------------------------------------------------
CREATE TABLE `icasus_indicador` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_entidad` int(11) unsigned DEFAULT '0',
`id_proceso` int(11) unsigned DEFAULT NULL,
`id_responsable` int(11) DEFAULT NULL COMMENT 'Responsable de seguimiento',
`id_responsable_medicion` int(11) DEFAULT NULL,
`id_visibilidad` tinyint(4) DEFAULT '1',
`id_tipo_agregacion_temporal` int(11) DEFAULT NULL,
`codigo` varchar(100) DEFAULT NULL,
`nombre` varchar(200) DEFAULT '',
`descripcion` text,
`formulacion` text,
`calculo` varchar(250) DEFAULT NULL,
`periodicidad` varchar(50) DEFAULT '',
`fuente_informacion` varchar(250) DEFAULT '' COMMENT 'Origen o referencia del indicador',
`id_tipo_agregacion` int(11) DEFAULT NULL,
`fuente_datos` varchar(250) DEFAULT NULL,
`desagregado` int(1) DEFAULT NULL COMMENT '0->No está desegregado, responable de medición 1->Esta desagregado, responsable de centro 2->Esta desagregado, responsable de medición',
`evidencia` varchar(250) DEFAULT NULL,
`historicos` smallint(6) DEFAULT NULL,
`unidad_generadora` varchar(250) DEFAULT NULL,
`interpretacion` text,
`fecha_creacion` date DEFAULT NULL,
`version` varchar(50) DEFAULT NULL,
`observaciones` text,
`valor_min` double DEFAULT NULL,
`valor_max` double DEFAULT NULL,
`inverso` tinyint(1) NOT NULL,
`archivado` date DEFAULT NULL,
`control` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `Index_nombre` (`nombre`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_indicador_dependencia
# ------------------------------------------------------------
CREATE TABLE `icasus_indicador_dependencia` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_calculado` int(11) unsigned NOT NULL,
`id_operando` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_indicador_subunidad
# ------------------------------------------------------------
CREATE TABLE `icasus_indicador_subunidad` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_indicador` int(10) unsigned NOT NULL,
`id_usuario` int(10) unsigned NOT NULL,
`id_entidad` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_linea
# ------------------------------------------------------------
CREATE TABLE `icasus_linea` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_plan` int(10) unsigned NOT NULL,
`indice` int(10) unsigned NOT NULL,
`nombre` varchar(150) NOT NULL DEFAULT '',
`descripcion` TEXT NULL,
`ejecucion` double NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_medicion
# ------------------------------------------------------------
CREATE TABLE `icasus_medicion` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_indicador` int(10) unsigned NOT NULL,
`etiqueta` varchar(50) NOT NULL DEFAULT '',
`periodo_inicio` date DEFAULT NULL,
`periodo_fin` date DEFAULT NULL,
`grabacion_inicio` date DEFAULT NULL,
`grabacion_fin` date DEFAULT NULL,
`observaciones` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_normativa
# ------------------------------------------------------------
CREATE TABLE `icasus_normativa` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_carta` int(10) unsigned NOT NULL,
`nombre` varchar(100) CHARACTER SET latin1 NOT NULL,
`enlace` varchar(100) CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_objetivo_estrategico
# ------------------------------------------------------------
CREATE TABLE `icasus_objetivo_estrategico` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_linea` int(10) unsigned NOT NULL,
`indice` int(10) unsigned NOT NULL,
`nombre` varchar(250) NOT NULL DEFAULT '',
`descripcion` TEXT NULL,
`ejecucion` double NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_objetivo_indicador
# ------------------------------------------------------------
CREATE TABLE `icasus_objetivo_indicador` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_objop` int(10) unsigned NOT NULL,
`id_indicador` int(10) unsigned NOT NULL,
`control` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_objetivo_operacional
# ------------------------------------------------------------
CREATE TABLE `icasus_objetivo_operacional` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_objest` int(10) unsigned NOT NULL,
`id_responsable` int(10) unsigned NOT NULL,
`indice` int(10) unsigned NOT NULL,
`nombre` varchar(250) NOT NULL DEFAULT '',
`ejecucion` double NOT NULL,
`descendente` tinyint(1) NOT NULL,
`peso` double NOT NULL DEFAULT '1',
`observaciones` text,
`descripcion` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_objetivo_unidad
# ------------------------------------------------------------
CREATE TABLE `icasus_objetivo_unidad` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_objop` int(10) unsigned NOT NULL,
`id_entidad` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_pagina
# ------------------------------------------------------------
CREATE TABLE `icasus_pagina` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`titulo` varchar(250) NOT NULL DEFAULT '',
`contenido` text NOT NULL,
`alias` varchar(50) NOT NULL DEFAULT '',
`modified` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_panel
# ------------------------------------------------------------
CREATE TABLE `icasus_panel` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_cuadro` int(11) NOT NULL,
`nombre` varchar(200) NOT NULL DEFAULT '',
`id_paneltipo` tinyint(4) NOT NULL,
`id_medicion` int(10) unsigned DEFAULT NULL,
`orden` smallint(6) DEFAULT NULL,
`ancho` tinyint(4) DEFAULT NULL,
`periodicidad` varchar(25) DEFAULT NULL,
`anyo_inicio` smallint(6) DEFAULT NULL,
`anyo_fin` smallint(6) DEFAULT NULL,
`anyos_atras` smallint(6) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_panel_indicador
# ------------------------------------------------------------
CREATE TABLE `icasus_panel_indicador` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_panel` int(11) unsigned NOT NULL,
`id_indicador` int(10) unsigned NOT NULL,
`id_entidad` int(11) unsigned NOT NULL,
`mostrar_referencias` tinyint(1) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_panel_tipo
# ------------------------------------------------------------
CREATE TABLE `icasus_panel_tipo` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nombre` varchar(50) NOT NULL DEFAULT '',
`ancho_pred` tinyint(4) NOT NULL,
`clase_css` varchar(25) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_plan
# ------------------------------------------------------------
CREATE TABLE `icasus_plan` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_entidad` int(11) NOT NULL,
`anyo_inicio` int(11) NOT NULL,
`duracion` int(11) NOT NULL,
`mision` text,
`vision` text,
`valores` text,
`fce` text,
`titulo` varchar(100) DEFAULT NULL,
`ejecucion` double NOT NULL,
`archivado` date DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_proceso
# ------------------------------------------------------------
CREATE TABLE `icasus_proceso` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_madre` int(11) unsigned DEFAULT '0',
`nombre` varchar(250) DEFAULT NULL,
`id_cuadro` int(11) unsigned DEFAULT '0',
`id_entidad` int(11) unsigned DEFAULT NULL,
`id_propietario` int(11) unsigned DEFAULT NULL,
`actividades` text,
`activo` tinyint(1) DEFAULT '1',
`alcance` varchar(250) DEFAULT NULL,
`clientes` varchar(250) DEFAULT NULL,
`codigo` varchar(250) DEFAULT NULL,
`documentacion` text,
`equipo_de_proceso` text,
`entradas` varchar(250) DEFAULT NULL,
`fecha_revision` datetime DEFAULT NULL,
`mediciones` varchar(250) DEFAULT NULL,
`mision` text,
`proveedores` varchar(250) DEFAULT NULL,
`resultados_clave` text,
`revision` varchar(5) DEFAULT NULL,
`salidas` varchar(250) DEFAULT NULL,
`registros` varchar(250) DEFAULT NULL,
`variables_control` text,
`observaciones` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_rol
# ------------------------------------------------------------
CREATE TABLE `icasus_rol` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nombre` varchar(250) NOT NULL,
`orden` int(11) NOT NULL,
`objeto` varchar(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_servicio
# ------------------------------------------------------------
CREATE TABLE `icasus_servicio` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_carta` int(10) unsigned NOT NULL,
`indice` int(10) unsigned NOT NULL,
`nombre` varchar(200) NOT NULL,
`descripcion` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_tipo_agregacion
# ------------------------------------------------------------
CREATE TABLE `icasus_tipo_agregacion` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`descripcion` varchar(100) DEFAULT NULL,
`operador` varchar(50) DEFAULT NULL,
`explicacion` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_usuario
# ------------------------------------------------------------
CREATE TABLE `icasus_usuario` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`login` varchar(50) NOT NULL,
`clave` varchar(45) DEFAULT '',
`nombre` varchar(45) NOT NULL DEFAULT '',
`apellidos` varchar(75) NOT NULL DEFAULT '',
`nif` varchar(10) NOT NULL DEFAULT '',
`correo` varchar(75) NOT NULL DEFAULT '',
`telefono` varchar(15) DEFAULT NULL,
`mis_notas` text,
`unidad_hominis` varchar(200) DEFAULT NULL,
`puesto` varchar(250) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_usuario_entidad
# ------------------------------------------------------------
CREATE TABLE `icasus_usuario_entidad` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_usuario` int(10) unsigned NOT NULL DEFAULT '0',
`id_entidad` int(10) unsigned NOT NULL DEFAULT '0',
`id_rol` int(11) NOT NULL,
`principal` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `id_usuario` (`id_usuario`,`id_entidad`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_valor
# ------------------------------------------------------------
CREATE TABLE `icasus_valor` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_medicion` int(10) unsigned NOT NULL DEFAULT '0',
`id_entidad` int(10) unsigned NOT NULL DEFAULT '0',
`id_usuario` int(10) unsigned DEFAULT NULL,
`valor` double DEFAULT NULL,
`valor_parcial` double DEFAULT NULL,
`fecha_recogida` date DEFAULT NULL,
`activo` tinyint(1) DEFAULT '1',
`observaciones` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_valor_referencia
# ------------------------------------------------------------
CREATE TABLE `icasus_valor_referencia` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_indicador` int(10) unsigned DEFAULT NULL,
`activo` tinyint(4) DEFAULT '1',
`etiqueta` varchar(100) NOT NULL DEFAULT '',
`grafica` tinyint(1) DEFAULT '1',
`nombre` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_valor_referencia_medicion
# ------------------------------------------------------------
CREATE TABLE `icasus_valor_referencia_medicion` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_valor_referencia` int(10) unsigned NOT NULL,
`id_medicion` int(10) unsigned NOT NULL,
`valor` double DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
# Volcado de tabla icasus_visibilidad
# ------------------------------------------------------------
CREATE TABLE `icasus_visibilidad` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(100) NOT NULL DEFAULT '',
`descripcion` varchar(250) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;
| 32.19697 | 181 | 0.645595 |
047a2fdecb386fe4fc5939d1cb244ec38cf90b6b | 194 | java | Java | src/test/java/com/flipkart/databuilderframework/cmplxscenariotest/data/DataF.java | nottocode/databuilderframework | 76fa83914b836d2288de2a46bc337910353d0b14 | [
"Apache-2.0"
] | 19 | 2015-06-12T05:32:34.000Z | 2021-09-14T23:15:02.000Z | src/test/java/com/flipkart/databuilderframework/cmplxscenariotest/data/DataF.java | nottocode/databuilderframework | 76fa83914b836d2288de2a46bc337910353d0b14 | [
"Apache-2.0"
] | 25 | 2015-04-21T07:09:47.000Z | 2021-05-04T19:23:21.000Z | src/test/java/com/flipkart/databuilderframework/cmplxscenariotest/data/DataF.java | nottocode/databuilderframework | 76fa83914b836d2288de2a46bc337910353d0b14 | [
"Apache-2.0"
] | 27 | 2015-04-22T17:30:29.000Z | 2022-02-17T11:59:51.000Z | package com.flipkart.databuilderframework.cmplxscenariotest.data;
import com.flipkart.databuilderframework.model.Data;
public class DataF extends Data {
public DataF() {
super("F");
}
}
| 16.166667 | 65 | 0.768041 |
2f4f4a0e2405003357a12f4940ed5d6cff372800 | 3,765 | php | PHP | resources/views/admin/dashboard/manage-dashboard/index.blade.php | CLICKYSOFT90/primoticketing | 4d151cb155f9354a67e12334c983edfce77dd470 | [
"MIT"
] | null | null | null | resources/views/admin/dashboard/manage-dashboard/index.blade.php | CLICKYSOFT90/primoticketing | 4d151cb155f9354a67e12334c983edfce77dd470 | [
"MIT"
] | null | null | null | resources/views/admin/dashboard/manage-dashboard/index.blade.php | CLICKYSOFT90/primoticketing | 4d151cb155f9354a67e12334c983edfce77dd470 | [
"MIT"
] | null | null | null | @extends('adminlte::page')
@section('title', 'Dashboard')
@section('content_header')
@stop
@section('content')
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<a class="dashboard-stat dashboard-stat-v2 white" href="javascript:;">
<div class="visual">
<i class="fas fa-user-tie"></i>
</div>
<div class="details">
<div class="number">
<span data-counter="counterup">472</span>
</div>
<div class="desc"> Online Organizations </div>
</div>
</a>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<a class="dashboard-stat dashboard-stat-v2 white" href="javascript:;">
<div class="visual">
<i class="far fa-calendar-alt"></i>
</div>
<div class="details">
<div class="number">
<span data-counter="counterup">1,838</span></div>
<div class="desc"> Active Events </div>
</div>
</a>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<a class="dashboard-stat dashboard-stat-v2 white" href="javascript:;">
<div class="visual">
<i class="fas fa-ticket-alt"></i>
</div>
<div class="details">
<div class="number">
<span data-counter="counterup">15,282</span>
</div>
<div class="desc">Tickets Sold Today </div>
</div>
</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="portlet light bordered" style="padding-bottom: 3.5em;">
<div class="portlet-title tabbable-line">
<div class="caption">
<span class="caption-subject font-green bold uppercase">Recent Organizations</span>
</div>
</div>
<div class="portlet-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" id="userTable">
<thead>
<tr>
<th>Organization</th>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody><tr class="" id="row1">
<td>BCI Events</td>
<td>Matthew David Graff</td>
<td>mg@graffx.com</td>
</tr>
</tbody></table>
</div> <!-- /.table-responsive -->
<a href="#">
<span class="pull-right btn btn-circle green btn-outline">
View More...
</span>
</a>
</div>
</div>
</div>
</div>
@stop
@section('css')
@stop
@section('plugins.Chartjs', true)
@section('js')
@stop | 38.814433 | 107 | 0.360956 |
569ac83da3b258c34091ba0ecf361755123640a3 | 814 | go | Go | internal/providers/docker/component.go | balupton/exo | ef030ea1dc8a425da47ef25b6714e30284113184 | [
"Apache-2.0"
] | 270 | 2021-07-22T15:39:35.000Z | 2022-03-28T18:27:45.000Z | internal/providers/docker/component.go | balupton/exo | ef030ea1dc8a425da47ef25b6714e30284113184 | [
"Apache-2.0"
] | 295 | 2021-07-19T15:20:53.000Z | 2022-03-23T00:17:59.000Z | internal/providers/docker/component.go | balupton/exo | ef030ea1dc8a425da47ef25b6714e30284113184 | [
"Apache-2.0"
] | 8 | 2021-08-19T22:28:22.000Z | 2022-01-26T02:50:00.000Z | package docker
import (
"github.com/deref/exo/internal/providers/core"
"github.com/deref/exo/internal/providers/docker/compose"
"github.com/deref/exo/internal/util/yamlutil"
dockerclient "github.com/docker/docker/client"
)
type ComponentBase struct {
core.ComponentBase
Docker *dockerclient.Client
}
func (c ComponentBase) GetExoLabels() map[string]string {
return map[string]string{
"io.deref.exo.workspace": c.WorkspaceID,
"io.deref.exo.component": c.ComponentID,
}
}
func LoadSpec(s string, v compose.Interpolator, env map[string]string) error {
if err := yamlutil.UnmarshalString(s, v); err != nil {
return err
}
return v.Interpolate(compose.MapEnvironment(env))
}
func (c ComponentBase) LoadSpec(s string, v compose.Interpolator) error {
return LoadSpec(s, v, c.WorkspaceEnvironment)
}
| 25.4375 | 78 | 0.756757 |
40ebe5d1d0fea56e22cd062c7698c35c7b61db31 | 445 | py | Python | enterprise_manage/apps/score_center/serializers.py | x315904752/enterprise_manage | ac679d8e7221080dadfdbe6d8ac6ece0b19ed1f1 | [
"MIT"
] | null | null | null | enterprise_manage/apps/score_center/serializers.py | x315904752/enterprise_manage | ac679d8e7221080dadfdbe6d8ac6ece0b19ed1f1 | [
"MIT"
] | 2 | 2020-06-06T01:09:13.000Z | 2021-06-10T22:26:59.000Z | enterprise_manage/apps/score_center/serializers.py | x315904752/enterprise_manage | ac679d8e7221080dadfdbe6d8ac6ece0b19ed1f1 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from enterprise_manage.apps.score_center.models import *
class ScoreResultSerializer(serializers.ModelSerializer):
user_photo = serializers.CharField(source='user_photo.url')
class Meta:
model = UserProfile
fields = ['name', 'user_photo']
class ScoreProjectSerializer(serializers.ModelSerializer):
class Meta:
model = ScoreProject
fields = ['id', 'name']
| 23.421053 | 63 | 0.721348 |
24fdbfe7b11f8a593cfd9117e2c3e5dc295f414d | 140 | go | Go | log/cuslog/formatter.go | developbiao/gopractise-demo | 490d5369acf227ba21c9b603179b3dcd6bae0f9b | [
"MIT"
] | null | null | null | log/cuslog/formatter.go | developbiao/gopractise-demo | 490d5369acf227ba21c9b603179b3dcd6bae0f9b | [
"MIT"
] | null | null | null | log/cuslog/formatter.go | developbiao/gopractise-demo | 490d5369acf227ba21c9b603179b3dcd6bae0f9b | [
"MIT"
] | null | null | null | package cuslog
type Formatter interface {
// Maybe in async goroutine
// Please write the result to buffer
Format(entry *Entry) error
}
| 17.5 | 37 | 0.75 |
e5210b297826888514106af598ebdae1cdebd3bc | 936 | html | HTML | manuscript/page-613/body.html | marvindanig/gulliver-s-travels-into-several-remote-nations-of-the-world | 057aeff45ae8503183edb4edec25768bd2248085 | [
"CECILL-B"
] | null | null | null | manuscript/page-613/body.html | marvindanig/gulliver-s-travels-into-several-remote-nations-of-the-world | 057aeff45ae8503183edb4edec25768bd2248085 | [
"CECILL-B"
] | null | null | null | manuscript/page-613/body.html | marvindanig/gulliver-s-travels-into-several-remote-nations-of-the-world | 057aeff45ae8503183edb4edec25768bd2248085 | [
"CECILL-B"
] | null | null | null | <div class="leaf flex"><div class="inner justify"><p>I had hitherto concealed the secret of my dress, in order to distinguish myself, as much as possible, from that cursed race of Yahoos; but now I found it in vain to do so any longer. Besides, I considered that my clothes and shoes would soon wear out, which already were in a declining condition, and must be supplied by some contrivance from the hides of Yahoos, or other brutes; whereby the whole secret would be known. I therefore told my master, “that in the country whence I came, those of my kind always covered their bodies with the hairs of certain animals prepared by art, as well for decency as to avoid the inclemencies of air, both hot and cold; of which, as to my own person, I would give him immediate conviction, if he pleased to command me: only desiring his excuse, if I did not expose those parts that nature taught us to conceal.</p></div> </div> | 936 | 936 | 0.775641 |
e97298103f46bc7dba782bd59a5fae1a0757045e | 6,519 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2127.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2127.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2127.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r8
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x12069, %r12
inc %r9
movw $0x6162, (%r12)
nop
nop
nop
nop
nop
lfence
lea addresses_normal_ht+0x9d29, %r13
clflush (%r13)
nop
nop
nop
nop
nop
inc %r8
mov (%r13), %eax
xor %r9, %r9
lea addresses_D_ht+0x13ca9, %rbx
nop
nop
nop
nop
nop
sub $13525, %r9
mov (%rbx), %ax
nop
nop
nop
nop
nop
add $34370, %r8
lea addresses_A_ht+0xbb69, %r8
clflush (%r8)
nop
nop
inc %r11
movb $0x61, (%r8)
nop
nop
nop
inc %r11
lea addresses_UC_ht+0xcfa9, %rsi
lea addresses_A_ht+0x17245, %rdi
nop
nop
nop
cmp $17944, %r13
mov $10, %rcx
rep movsw
add %r8, %r8
lea addresses_D_ht+0x13da1, %rsi
lea addresses_D_ht+0x1ca9, %rdi
nop
nop
nop
nop
and %rbx, %rbx
mov $81, %rcx
rep movsl
nop
nop
nop
nop
nop
add $61091, %rdi
lea addresses_UC_ht+0x18d63, %rsi
lea addresses_normal_ht+0x19de9, %rdi
and %r8, %r8
mov $76, %rcx
rep movsw
and $64528, %r13
lea addresses_D_ht+0x1c0a9, %rsi
lea addresses_WT_ht+0x156b9, %rdi
nop
xor %r13, %r13
mov $14, %rcx
rep movsw
nop
nop
nop
dec %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r15
push %r8
push %r9
push %rdx
// Load
lea addresses_UC+0x1fba9, %r13
clflush (%r13)
nop
and %r9, %r9
vmovups (%r13), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %r10
nop
nop
xor $37921, %r13
// Store
lea addresses_PSE+0xbb69, %r12
nop
nop
nop
nop
nop
and %r8, %r8
mov $0x5152535455565758, %r9
movq %r9, (%r12)
nop
sub $34236, %r9
// Faulty Load
lea addresses_D+0xdca9, %r10
nop
nop
nop
nop
nop
and %r15, %r15
mov (%r10), %r8w
lea oracles, %r12
and $0xff, %r8
shlq $12, %r8
mov (%r12,%r8,1), %r8
pop %rdx
pop %r9
pop %r8
pop %r15
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_D', 'same': True, 'size': 2, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A_ht', 'same': True, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 35.237838 | 2,999 | 0.657003 |
fce823c383309b06d065aceddbe81fb8e74bad82 | 1,433 | css | CSS | MEDIUM/medium.css | bgoonz/html-demo-code-and-experiments | b0f9bfea84f2102e6aeacc7add36533578826aaf | [
"Apache-2.0"
] | 3 | 2021-11-15T07:54:37.000Z | 2021-11-29T03:09:12.000Z | MEDIUM/medium.css | bgoonz/html-demo-code-and-experiments | b0f9bfea84f2102e6aeacc7add36533578826aaf | [
"Apache-2.0"
] | 26 | 2021-11-15T04:26:39.000Z | 2021-11-17T00:17:06.000Z | MEDIUM/medium.css | bgoonz/html-demo-code-and-experiments | b0f9bfea84f2102e6aeacc7add36533578826aaf | [
"Apache-2.0"
] | null | null | null | * {
font-family: Georgia, Cambria, "Times New Roman", Times, serif;
}
::-webkit-resizer {
border: 2px solid black;
background: red;
box-shadow: 0 0 5px 5px blue;
outline: 2px solid yellow;
}
#resizable {
display: block;
font-size: 9pt;
position: absolute;
bottom: 50px;
left: 20px;
padding: 10px;
min-height: 0;
min-width: 0;
border: solid 1px black;
width: 500px;
height: 400px;
overflow-x: auto;
overflow-y: auto;
}
html,
body {
margin: auto;
padding: 0;
}
h1 {
font-size: 50px;
margin-bottom: 17px;
color: #333;
}
h2 {
font-size: 24px;
line-height: 1.6;
margin: 60px 0 0 0;
margin-bottom: 18px;
margin-top: 33px;
color: #333;
}
h3 {
font-size: 30px;
margin: 10px 0 20px 0;
color: #333;
}
header {
width: 840px;
zoom: 0.8;
}
section {
width: 840px;
margin-left: 25px;
zoom: 0;
}
section p {
margin-bottom: 27px;
font-size: 26px;
line-height: 1.8;
color: rgb(0, 0, 0);
}
section img {
max-width: 440px;
}
footer {
padding: 0 20px;
margin: 50px 0;
text-align: center;
font-size: 12px;
}
.aspectRatioPlaceholder {
max-width: auto !important;
max-height: auto !important;
}
.aspectRatioPlaceholder-fill {
padding-bottom: 0 !important;
}
header,
section[data-field="subtitle"],
section[data-field="description"] {
display: none;
}
| 15.084211 | 66 | 0.594557 |
b81580621ce887c1f4559de5674eead84896f8d6 | 15,526 | sql | SQL | DomeOS/src/main/resources/create-db.sql | eliukehua/domeos-mye | b476603512d2f8a8d50b697c793bc6cebf5ab575 | [
"Apache-2.0"
] | null | null | null | DomeOS/src/main/resources/create-db.sql | eliukehua/domeos-mye | b476603512d2f8a8d50b697c793bc6cebf5ab575 | [
"Apache-2.0"
] | null | null | null | DomeOS/src/main/resources/create-db.sql | eliukehua/domeos-mye | b476603512d2f8a8d50b697c793bc6cebf5ab575 | [
"Apache-2.0"
] | null | null | null | CREATE TABLE IF NOT EXISTS `admin_roles` (
`userId` INT(11) NOT NULL PRIMARY KEY,
`role` VARCHAR(255) NOT NULL DEFAULT '0'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `build_history` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) NULL DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0',
`removeTime` BIGINT(20) NULL DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT NULL,
`projectId` INT(11) NOT NULL,
`secret` VARCHAR(255) NOT NULL,
`log` LONGBLOB NULL,
`taskName` VARCHAR(255) NULL DEFAULT NULL,
`dockerfileContent` MEDIUMTEXT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `build_history_name` ON build_history(`name`);
CREATE INDEX `build_history_projectId` ON build_history(`projectId`);
CREATE TABLE IF NOT EXISTS `gitlab_user` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`userId` INT(11) NOT NULL DEFAULT '0',
`name` VARCHAR(255) NOT NULL COMMENT 'username in gitlab',
`token` VARCHAR(255) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `gitlab_user_userId` ON gitlab_user(`userId`);
CREATE TABLE IF NOT EXISTS `groups` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL COMMENT 'group name',
`description` VARCHAR(255) NULL DEFAULT NULL,
`createTime` BIGINT(20) NULL DEFAULT NULL,
`updateTime` BIGINT(20) NULL DEFAULT NULL,
`state` INT(11) NULL DEFAULT '1'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `groups_name` ON groups(`name`);
CREATE TABLE IF NOT EXISTS `operation_history` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`resourceId` INT(11) NOT NULL,
`resourceType` VARCHAR(255) NOT NULL,
`operation` VARCHAR(255) NOT NULL,
`userId` INT(11) NOT NULL,
`userName` VARCHAR(255) NOT NULL,
`status` VARCHAR(255) NOT NULL,
`message` MEDIUMTEXT NOT NULL,
`operateTime` BIGINT(20) NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `project` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) NULL DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) NULL DEFAULT NULL,
`removeTime` BIGINT(20) NULL DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT NULL,
`authority` TINYINT(4) NOT NULL DEFAULT '0'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `project_name` ON project(`name`);
CREATE INDEX `project_authority` ON project(`authority`);
CREATE TABLE IF NOT EXISTS `project_rsakey_map` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`projectId` INT(11) NOT NULL,
`rsaKeypairId` INT(11) NOT NULL,
`keyId` INT(11) NOT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `project_rsakey_map_projectId` ON project_rsakey_map(`projectId`);
CREATE INDEX `project_rsakey_map_rsaKeypairId` ON project_rsakey_map(`rsaKeypairId`);
CREATE TABLE IF NOT EXISTS `resources` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`resourceId` INT(11) NOT NULL COMMENT 'projectId or deployId',
`resourceType` VARCHAR(255) NOT NULL COMMENT 'PROJECT or DEPLOY or CLUSTER',
`ownerId` INT(11) NOT NULL COMMENT 'userId or groupId',
`ownerType` VARCHAR(255) NOT NULL COMMENT 'USER or GROUP',
`role` VARCHAR(255) NOT NULL COMMENT 'role name',
`updateTime` BIGINT(20) NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `resources_resourceType` ON resources(`resourceType`);
CREATE INDEX `resources_resourceId` ON resources(`resourceId`);
CREATE INDEX `resources_ownerId` ON resources(`ownerId`);
CREATE INDEX `resources_ownerType` ON resources(`ownerType`);
CREATE TABLE IF NOT EXISTS `rsa_keypair` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) NULL DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0',
`removeTime` BIGINT(20) NULL DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT NULL,
`authority` INT(11) NOT NULL DEFAULT '0'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `rsa_keypair_name` ON rsa_keypair(`name`);
CREATE TABLE IF NOT EXISTS `subversion_user` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`userId` INT(11) NOT NULL DEFAULT '0',
`name` VARCHAR(255) NOT NULL COMMENT 'username in subversion',
`password` VARCHAR(255) NOT NULL,
`svnPath` VARCHAR(255) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `subversion_user_userId` ON subversion_user(`userId`);
CREATE TABLE IF NOT EXISTS `users` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`username` VARCHAR(255) NOT NULL,
`password` VARCHAR(255) NOT NULL,
`salt` VARCHAR(255) NULL DEFAULT NULL,
`email` VARCHAR(255) NULL DEFAULT NULL,
`phone` VARCHAR(255) NULL DEFAULT NULL,
`loginType` VARCHAR(255) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0',
`updateTime` BIGINT(20) NOT NULL DEFAULT '0',
`state` VARCHAR(128) NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `users_state` ON users(`state`);
CREATE INDEX `users_username` ON users(`username`);
CREATE TABLE IF NOT EXISTS `user_group_map` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`groupId` INT(11) NOT NULL,
`userId` INT(11) NOT NULL,
`role` VARCHAR(255) NOT NULL COMMENT 'role name',
`updateTime` BIGINT(20) NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `user_group_map_userId` ON user_group_map(`userId`);
CREATE INDEX `user_group_map_groupId` ON user_group_map(`groupId`);
CREATE TABLE IF NOT EXISTS `deployment` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) NULL DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0',
`removeTime` BIGINT(20) NULL DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT NULL,
`clusterId` INT(11) DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `version` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) DEFAULT NULL,
`removeTime` BIGINT(20) DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT NULL,
`deployId` INT(11) DEFAULT NULL,
`version` BIGINT(20) DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `cluster` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) DEFAULT NULL,
`removeTime` BIGINT(20) DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `load_balancer` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) DEFAULT NULL,
`removeTime` BIGINT(20) DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `load_balancer_deploy_map` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) DEFAULT NULL,
`removeTime` BIGINT(20) DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT,
`deployId` INT(11) DEFAULT NULL,
`loadBalancerId` INT(11) DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `uniq_port_index` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`lbid` INT(11) NOT NULL,
`port` INT(11) NOT NULL,
`clusterId` INT(11) NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE UNIQUE INDEX `uniq_port_index_cluster_port` ON uniq_port_index(`port`, `clusterId`);
CREATE TABLE IF NOT EXISTS `file_content` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) NULL DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0',
`removeTime` BIGINT(20) NULL DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT NULL,
`md5` VARCHAR(255) NOT NULL DEFAULT '0',
`content` LONGBLOB NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `file_content_name` ON file_content(`name`);
CREATE INDEX `file_content_md5` ON file_content(`md5`);
CREATE TABLE IF NOT EXISTS `base_image_custom` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` VARCHAR(1024) NULL DEFAULT NULL,
`state` VARCHAR(128) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0',
`removeTime` BIGINT(20) NULL DEFAULT NULL,
`removed` TINYINT(4) NOT NULL DEFAULT '0',
`data` MEDIUMTEXT NULL,
`isGC` INT(11) NULL DEFAULT '0',
`logMD5` VARCHAR(255) NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `base_image_custom_name` ON base_image_custom(`name`);
CREATE TABLE IF NOT EXISTS `base_images` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`imageName` VARCHAR(255) NOT NULL DEFAULT '0',
`imageTag` VARCHAR(255) NULL DEFAULT '0',
`registry` VARCHAR(255) NULL DEFAULT '0',
`description` TEXT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `global` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`type` VARCHAR(255) NOT NULL,
`value` VARCHAR(4096) NOT NULL,
`createTime` BIGINT(20) NOT NULL DEFAULT '0',
`lastUpdate` BIGINT(20) NOT NULL DEFAULT '0'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `monitor_targets` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`target` VARCHAR(10240) NULL DEFAULT NULL,
`create_time` DATETIME NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `k8s_events` (
`id` INT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`version` VARCHAR(255) NOT NULL,
`clusterId` INT(11) NOT NULL,
`deployId` INT(11) NOT NULL DEFAULT -1,
`namespace` VARCHAR(255) NOT NULL,
`eventKind` VARCHAR(255) NOT NULL,
`name` VARCHAR(255) NOT NULL,
`host` VARCHAR(255),
`content` TEXT
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE INDEX `k8s_events_kind_index` ON k8s_events(`clusterId`, `namespace`, `eventKind`);
CREATE INDEX `k8s_events_name_index` ON k8s_events(`clusterId`, `namespace`, `name`);
CREATE INDEX `k8s_events_host_index` ON k8s_events(`host`);
CREATE INDEX `k8s_events_deploy_index` ON k8s_events(`clusterId`, `namespace`, `deployId`);
CREATE TABLE IF NOT EXISTS `deploy_event` (
`eid` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`deployId` INT(11) DEFAULT NULL,
`operation` VARCHAR(255) DEFAULT NULL,
`eventStatus` VARCHAR(255) DEFAULT NULL,
`statusExpire` BIGINT(20) DEFAULT NULL,
`content` MEDIUMTEXT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm related tables: 11 in total
-- 2016.04.14
-- alarm event info
CREATE TABLE IF NOT EXISTS `alarm_event_info_draft` (
`id` VARCHAR(64) NOT NULL PRIMARY KEY,
`endpoint` VARCHAR(128) NULL DEFAULT NULL,
`metric` VARCHAR(128) NULL DEFAULT NULL,
`counter` VARCHAR(128) NULL DEFAULT NULL,
`func` VARCHAR(128) NULL DEFAULT NULL,
`left_value` VARCHAR(128) NULL DEFAULT NULL,
`operator` VARCHAR(128) NULL DEFAULT NULL,
`right_value` VARCHAR(128) NULL DEFAULT NULL,
`note` VARCHAR(4096) NULL DEFAULT NULL,
`max_step` INT(20) NULL DEFAULT NULL,
`current_step` INT(20) NULL DEFAULT NULL,
`priority` INT(20) NULL DEFAULT NULL,
`status` VARCHAR(128) NULL DEFAULT NULL,
`timestamp` INT(20) NULL DEFAULT NULL,
`expression_id` INT(20) NULL DEFAULT NULL,
`strategy_id` INT(20) NULL DEFAULT NULL,
`template_id` INT(20) NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm callback
CREATE TABLE IF NOT EXISTS `alarm_callback_info` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`url` VARCHAR(256) NULL DEFAULT NULL,
`beforeCallbackSms` TINYINT(1) NULL DEFAULT NULL,
`beforeCallbackMail` TINYINT(1) NULL DEFAULT NULL,
`afterCallbackSms` TINYINT(1) NULL DEFAULT NULL,
`afterCallbackMail` TINYINT(1) NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm host info
CREATE TABLE IF NOT EXISTS `alarm_host_info` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`hostname` VARCHAR(128) NULL DEFAULT NULL,
`ip` VARCHAR(128) NULL DEFAULT NULL,
`cluster` VARCHAR(128) NULL DEFAULT NULL,
`createTime` BIGINT(20) NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm host group info
CREATE TABLE IF NOT EXISTS `alarm_host_group_info` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`hostGroupName` VARCHAR(128) NULL DEFAULT NULL,
`creatorId` INT(11) NULL DEFAULT NULL,
`creatorName` VARCHAR(128) NULL DEFAULT NULL,
`createTime` BIGINT(20) NULL DEFAULT NULL,
`updateTime` BIGINT(20) NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm strategy info
CREATE TABLE IF NOT EXISTS `alarm_strategy_info` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`metric` VARCHAR(64) NULL DEFAULT NULL,
`tag` VARCHAR(128) NULL DEFAULT NULL,
`pointNum` INT(11) NULL DEFAULT NULL,
`aggregateType` VARCHAR(64) NULL DEFAULT NULL,
`operator` VARCHAR(64) NULL DEFAULT NULL,
`rightValue` DOUBLE NULL DEFAULT NULL,
`note` VARCHAR(1024) NULL DEFAULT NULL,
`maxStep` INT(11) NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm template info
CREATE TABLE IF NOT EXISTS `alarm_template_info` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`templateName` VARCHAR(64) NULL DEFAULT NULL,
`templateType` VARCHAR(64) NULL DEFAULT NULL,
`creatorId` INT(11) NULL DEFAULT NULL,
`creatorName` VARCHAR(128) NULL DEFAULT NULL,
`createTime` BIGINT(20) NULL DEFAULT NULL,
`updateTime` BIGINT(20) NULL DEFAULT NULL,
`callbackId` INT(11) NULL DEFAULT NULL,
`deployId` INT(11) NULL DEFAULT NULL,
`isRemoved` TINYINT(4) NOT NULL DEFAULT '0'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm host group & host bind
CREATE TABLE IF NOT EXISTS `alarm_host_group_host_bind` (
`hostGroupId` INT(11) NOT NULL,
`hostId` INT(11) NOT NULL,
`bindTime` BIGINT(20) NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm template & host group bind
CREATE TABLE IF NOT EXISTS `alarm_template_host_group_bind` (
`templateId` INT(11) NOT NULL,
`hostGroupId` INT(11) NOT NULL,
`bindTime` BIGINT(20) NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm template & user group bind
CREATE TABLE IF NOT EXISTS `alarm_template_user_group_bind` (
`templateId` INT(11) NOT NULL,
`userGroupId` INT(11) NOT NULL,
`bindTime` BIGINT(20) NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm template & strategy bind
CREATE TABLE IF NOT EXISTS `alarm_template_strategy_bind` (
`templateId` INT(11) NOT NULL,
`strategyId` INT(11) NOT NULL,
`bindTime` BIGINT(20) NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- alarm link info
CREATE TABLE IF NOT EXISTS `alarm_link_info` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`content` MEDIUMTEXT NULL DEFAULT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
| 38.912281 | 91 | 0.734639 |
c2d0bd3625a42df9583bfc8f4546ff61d3b33663 | 340 | go | Go | model.go | korhov/migorm | b3bc2ddda93778d58b4bc566c71615fb512fa6f2 | [
"MIT"
] | 6 | 2018-11-15T17:13:54.000Z | 2021-01-26T09:06:45.000Z | model.go | korhov/migorm | b3bc2ddda93778d58b4bc566c71615fb512fa6f2 | [
"MIT"
] | 1 | 2019-07-11T14:09:10.000Z | 2019-07-11T14:33:42.000Z | model.go | korhov/migorm | b3bc2ddda93778d58b4bc566c71615fb512fa6f2 | [
"MIT"
] | 6 | 2018-11-16T08:42:47.000Z | 2020-11-24T05:08:25.000Z | package migorm
import (
"time"
)
type migrationModel struct {
Id uint `gorm:"primary_key;"`
Name string `gorm:"type:varchar(150);unique;not null"`
CreatedAt *time.Time
UpdatedAt *time.Time
tableName string `gorm:"-"` // for set custom table name
}
func (m migrationModel) TableName() string {
return m.tableName
} | 18.888889 | 60 | 0.685294 |
1e9dc9b5776f5c3931ba46647b008f0358e13b70 | 840 | swift | Swift | Sources/CyclePageView/CyclePageViewCell.swift | qiangjindong/CyclePageView | 6b86aef8c6bcb43394b41c949fc0e6810f06bb07 | [
"MIT"
] | 4 | 2020-03-30T07:12:57.000Z | 2020-03-31T08:08:42.000Z | Sources/CyclePageView/CyclePageViewCell.swift | qiangjindong/CyclePageView | 6b86aef8c6bcb43394b41c949fc0e6810f06bb07 | [
"MIT"
] | null | null | null | Sources/CyclePageView/CyclePageViewCell.swift | qiangjindong/CyclePageView | 6b86aef8c6bcb43394b41c949fc0e6810f06bb07 | [
"MIT"
] | null | null | null | //
// CyclePageViewCell.swift
// CyclePageView
//
// Created by QiangJindong on 2019/6/16.
// Copyright © 2019 QiangJindong. All rights reserved.
//
import UIKit
open class CyclePageViewCell: UICollectionViewCell {
public override init(frame: CGRect) {
super.init(frame: frame)
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
open lazy var textLabel: UILabel = {
let label = UILabel()
label.frame = contentView.bounds
self.contentView.addSubview(label)
return label
}()
open lazy var backgroundImageView: UIImageView = {
let imageView = UIImageView()
imageView.frame = contentView.bounds
self.contentView.addSubview(imageView)
return imageView
}()
}
| 24.705882 | 59 | 0.647619 |
9c0449c39d416dd316154d60934c9b060fcfa8fe | 11,522 | ts | TypeScript | src/mixins/Themeable.ts | tomdye/widget-core | 0f7f45ec906cb713e59670f065e466f187a645d3 | [
"BSD-3-Clause"
] | null | null | null | src/mixins/Themeable.ts | tomdye/widget-core | 0f7f45ec906cb713e59670f065e466f187a645d3 | [
"BSD-3-Clause"
] | null | null | null | src/mixins/Themeable.ts | tomdye/widget-core | 0f7f45ec906cb713e59670f065e466f187a645d3 | [
"BSD-3-Clause"
] | null | null | null | import { assign } from '@dojo/core/lang';
import { find } from '@dojo/shim/array';
import Map from '@dojo/shim/Map';
import { ClassesFunction, Constructor, WidgetProperties } from './../interfaces';
import { Registry } from './../Registry';
import { Injector } from './../Injector';
import { inject } from './../decorators/inject';
import { diffProperty, WidgetBase, handleDecorator } from './../WidgetBase';
import { shallow } from './../diff';
/**
* A representation of the css class names to be applied and
* removed.
*/
export type ClassNameFlags = {
[key: string]: boolean;
};
/**
* A lookup object for available class names
*/
export type ClassNames = {
[key: string]: string;
};
/**
* A lookup object for available widget classes names
*/
export interface Theme {
[key: string]: object;
}
/**
* Properties required for the themeable mixin
*/
export interface ThemeableProperties<T = ClassNames> extends WidgetProperties {
injectedTheme?: any;
theme?: Theme;
extraClasses?: { [P in keyof T]?: string };
}
/**
* Returned by classes function.
*/
export interface ClassesFunctionChain {
(): ClassNameFlags;
/**
* The theme classes to be returned when get() is called
*/
classes: string[];
/**
* The fixed classes to be returned when get() is called
*/
fixedClasses: string[];
/**
* Function to pass fixed class names that bypass the theming
* process
*/
fixed: (...classes: (string | null)[]) => ClassesFunctionChain;
/**
* Finalize function to return the generated class names
*/
get: ClassesFunction;
}
const THEME_KEY = ' _key';
export const INJECTED_THEME_KEY = Symbol('theme');
/**
* Interface for the ThemeableMixin
*/
export interface ThemeableMixin<T = ClassNames> {
/**
* Processes all the possible classes for the instance with setting the passed class names to
* true.
*
* @param ...classNames an array of class names
* @returns a function chain to `get` or process more classes using `fixed`
*/
classes(...classNames: (string | null)[]): ClassesFunctionChain;
properties: ThemeableProperties<T>;
}
/**
* Decorator for base css classes
*/
export function theme (theme: {}) {
return handleDecorator((target) => {
target.addDecorator('baseThemeClasses', theme);
});
}
/**
* Split class strings containing spaces into separate array entries.
* ie. ['class1 class2', 'class3] -> ['class1', 'class2', 'class3'];
*
* @param classes The array of class strings to split.
* @return the complete classes array including any split classes.
*/
function splitClassStrings(classes: string[]): string[] {
return classes.reduce((splitClasses: string[], className) => {
if (className.indexOf(' ') > -1) {
splitClasses.push(...className.split(' '));
}
else {
splitClasses.push(className);
}
return splitClasses;
}, []);
}
/**
* Returns the class object map based on the class names and whether they are
* active.
*
* @param className an array of string class names
* @param applied indicates is the class is applied
*/
function createClassNameObject(classNames: string[], applied: boolean) {
return classNames.reduce((flaggedClassNames: ClassNameFlags, className) => {
flaggedClassNames[className] = applied;
return flaggedClassNames;
}, {});
}
/**
* Creates a reverse lookup for the classes passed in via the `theme` function.
*
* @param classes The baseClasses object
* @requires
*/
function createThemeClassesLookup(classes: ClassNames[]): ClassNames {
return classes.reduce((currentClassNames, baseClass) => {
Object.keys(baseClass).forEach((key: string) => {
currentClassNames[baseClass[key]] = key;
});
return currentClassNames;
}, <ClassNames> {});
}
/**
* Convenience function that is given a theme and an optional registry, the theme
* injector is defined against the registry, returning the theme.
*
* @param theme the theme to set
* @param themeRegistry registry to define the theme injector against. Defaults
* to the global registry
*
* @returns the theme injector used to set the theme
*/
export function registerThemeInjector(theme: any, themeRegistry: Registry): Injector {
const themeInjector = new Injector(theme);
themeRegistry.defineInjector(INJECTED_THEME_KEY, themeInjector);
return themeInjector;
}
/**
* Function that returns a class decorated with with Themeable functionality
*/
export function ThemeableMixin<E, T extends Constructor<WidgetBase<ThemeableProperties<E>>>>(Base: T): Constructor<ThemeableMixin<E>> & T {
@inject({
name: INJECTED_THEME_KEY,
getProperties: (theme: Theme, properties: ThemeableProperties): ThemeableProperties => {
if (!properties.theme) {
return { theme };
}
return {};
}})
class Themeable extends Base {
public properties: ThemeableProperties<E>;
/**
* The Themeable baseClasses
*/
private _registeredBaseThemes: ClassNames[];
/**
* All classes ever seen by the instance
*/
private _allClasses: ClassNameFlags = {};
/**
* Reverse lookup of the theme classes
*/
private _baseThemeClassesReverseLookup: ClassNames;
/**
* Indicates if classes meta data need to be calculated.
*/
private _recalculateClasses = true;
/**
* Map of registered classes
*/
private _registeredClassesMap: Map<string, ClassNameFlags> = new Map<string, ClassNameFlags>();
/**
* Loaded theme
*/
private _theme: ClassNames = {};
/**
* Function used to add themeable classes to a widget. Returns a chained function 'fixed'
* that can be used to pass non-themeable classes to a widget. Filters out any null
* values passed.
*
* @param classNames the classes to be added to the domNode. These classes must come from
* the baseClasses passed into the @theme decorator.
* @return A function chain containing the 'fixed' function and a 'get' finalizer function.
* Class names passed to the 'fixed' function can be any string.
*
*/
public classes(...classNames: (string | null)[]): ClassesFunctionChain {
if (this._recalculateClasses) {
this._recalculateThemeClasses();
}
const themeable = this;
function classesGetter(this: ClassesFunctionChain) {
const themeClasses = themeable._getThemeClasses(this.classes);
const fixedClasses = themeable._getFixedClasses(this.fixedClasses);
return assign({}, themeable._allClasses, themeClasses, fixedClasses);
}
const classesFunctionChain = {
classes: classNames,
fixedClasses: [],
fixed(this: ClassesFunctionChain, ...classNames: (string | null)[]) {
const filteredClassNames = <string[]> classNames.filter((className) => className !== null);
this.fixedClasses.push(...filteredClassNames);
return this;
},
get: classesGetter
};
return assign(classesGetter.bind(classesFunctionChain), classesFunctionChain);
}
/**
* Function fired when `theme` or `extraClasses` are changed.
*/
@diffProperty('theme', shallow)
@diffProperty('extraClasses', shallow)
protected onPropertiesChanged() {
this._recalculateClasses = true;
}
/**
* Get theme class object from classNames
*/
private _getThemeClasses(classNames: string[]): ClassNameFlags {
return classNames
.filter((className) => !!className)
.reduce((appliedClasses: {}, className: string) => {
if (!this._baseThemeClassesReverseLookup[className]) {
console.warn(`Class name: ${className} not found, use chained 'fixed' method instead`);
return appliedClasses;
}
className = this._baseThemeClassesReverseLookup[className];
if (!this._registeredClassesMap.has(className)) {
this._registerThemeClass(className);
}
return assign(appliedClasses, this._registeredClassesMap.get(className));
}, {});
}
/**
* Get fixed class object from classNames
*/
private _getFixedClasses(classNames: string[]): ClassNameFlags {
const splitClasses = splitClassStrings(classNames);
this._appendToAllClassNames(splitClasses);
return createClassNameObject(splitClasses, true);
}
/**
* Adds classes to the internal allClasses property
*
* @param classNames an array of string class names
*/
private _appendToAllClassNames(classNames: string[]): void {
const negativeClassFlags = createClassNameObject(classNames, false);
this._allClasses = assign({}, this._allClasses, negativeClassFlags);
}
/**
* Register the classes object for the class name and adds the class to the instances `allClasses` object.
*
* @param className the name of the class to register.
*/
private _registerThemeClass(className: string) {
const { properties: { extraClasses = {} } } = this;
const themeClass = this._theme[className] ? this._theme[className] : this._getBaseThemeClass(className);
const extraClassesClassNames = extraClasses[className];
const extraClassesClassNamesArray = extraClassesClassNames ? extraClassesClassNames.split(' ') : [];
const cssClassNames = themeClass.split(' ').concat(extraClassesClassNamesArray);
const classesObject = cssClassNames.reduce((classesObject, cssClassName) => {
classesObject[cssClassName] = true;
this._allClasses[cssClassName] = false;
return classesObject;
}, <any> {});
this._registeredClassesMap.set(className, classesObject);
}
/**
* Recalculate registered classes for current theme.
*/
private _recalculateThemeClasses() {
const { properties: { injectedTheme = {}, theme = injectedTheme } } = this;
if (!this._registeredBaseThemes) {
this._registeredBaseThemes = [ ...this.getDecorator('baseThemeClasses') ].reverse();
this._checkForDuplicates();
}
const registeredBaseThemeKeys = this._registeredBaseThemes.map((registeredBaseThemeClasses) => {
return registeredBaseThemeClasses[THEME_KEY];
});
this._baseThemeClassesReverseLookup = createThemeClassesLookup(this._registeredBaseThemes);
this._theme = registeredBaseThemeKeys.reduce((baseTheme, themeKey) => {
return assign(baseTheme, theme[themeKey]);
}, {});
this._registeredClassesMap.forEach((value, key) => {
this._registerThemeClass(key);
});
this._recalculateClasses = false;
}
/**
* Find the base theme class for the class name
*/
private _getBaseThemeClass(className: string): string {
const registeredBaseTheme = find(this._registeredBaseThemes, (registeredBaseThemeClasses) => {
return Boolean(registeredBaseThemeClasses[className]);
});
return (registeredBaseTheme && registeredBaseTheme[className]) || '';
}
/**
* Check for duplicates across the registered base themes.
*/
private _checkForDuplicates(): void {
this._registeredBaseThemes.forEach((registeredBaseThemeClasses, index) => {
Object.keys(registeredBaseThemeClasses).some((key) => {
return this._isDuplicate(key, registeredBaseThemeClasses);
});
});
}
/**
* Search for the class name in other base themes
*/
private _isDuplicate(key: string, originatingBaseTheme: ClassNames): boolean {
let duplicate = false;
if (key !== THEME_KEY) {
for (let i = 0; i < this._registeredBaseThemes.length; i++) {
if (originatingBaseTheme === this._registeredBaseThemes[i]) {
continue;
}
if (this._registeredBaseThemes[i][key]) {
console.warn(`Duplicate base theme class key '${key}' detected, this could cause unexpected results`);
duplicate = true;
break;
}
}
return duplicate;
}
return duplicate;
}
}
return Themeable;
}
export default ThemeableMixin;
| 30.401055 | 139 | 0.702916 |
1fad29c9868ad32f675e95799cb02626a3724eac | 6,450 | html | HTML | pages/questions.html | salam1107/HW3-telhai-web-2019 | 7391f4b2a20e1aee83993deb02d48b1ad87ce54d | [
"MIT"
] | null | null | null | pages/questions.html | salam1107/HW3-telhai-web-2019 | 7391f4b2a20e1aee83993deb02d48b1ad87ce54d | [
"MIT"
] | 3 | 2019-05-12T13:39:00.000Z | 2019-06-07T15:07:34.000Z | pages/questions.html | salam1107/HW3-telhai-web-2019 | 7391f4b2a20e1aee83993deb02d48b1ad87ce54d | [
"MIT"
] | null | null | null | <html>
<head>
<link rel="stylesheet" type="text/css" href="../css/top_bar.css">
<link rel="stylesheet" type="text/css" href="../css/questions_page.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<div id="top_bar">
<span id="user_span">Hello, <span id="username_value"></span></span>
<button id="remove_name_btn">Remove Name</button>
<button id="change_name_btn">Change Name</button>
<button id="go_to_questions_btn">Go To Questions</button>
<button id="our_team_btn">Our Team</button>
</div>
<div id="exam_div">
<span id="exam_title">Random questions</span>
<br/><br/>
<div id="loading_fetching"></div>
</div>
<div id="failed_message">
<span id="failed_msg_content">Incorrect answers. You can retry with the same questions OR fetching new questions.</span>
<button id="same_questions_btn">Same questions</button>
<button id="fetch_new_questions">Fetch new questions</button>
</div>
<button id="check_exam_btn">Check Exam</button>
</body>
</html>
<script>
$(document).ready(function(){
localStorage.setItem("hasPermission", 0);
var username = "";
var question_number = 1;
var questions_answers = new Object();
var collected_answers = new Object();
if(localStorage.getItem("first_name") !== null || localStorage.getItem("last_name") !== null)
{
username = localStorage.getItem("first_name") + " " +localStorage.getItem("last_name");
}
else
{
window.location.href="../index.html";
}
$("#username_value").text(username);
$("#remove_name_btn").click(function(){
localStorage.removeItem("first_name");
localStorage.removeItem("last_name");
window.location.href="../index.html";
});
$("#change_name_btn").click(function(){
window.location.href="./change_name.html";
});
$("#our_team_btn").click(function(){
window.location.href="./our_team.html";
});
$("#go_to_questions_btn").click(function(){
window.location.href="./questions.html";
});
var fetch_questions = function(){
$.ajax({
url: "https://opentdb.com/api.php?amount=3",
type: "GET",
beforeSend: function(){
$("#loading_fetching").html('Fetching questions, Please wait...<br/><img src="../images/loading.gif" width="50px" height="50px"/>');
},
success: function(data){
$("#loading_fetching").html('');
var results = data.results;
for(let i=0; i<results.length; i++)
{
let question_content = results[i].question;
let answers = [];
answers.push(results[i].correct_answer);
questions_answers[question_number] = results[i].correct_answer;
let incorrect_answers = results[i].incorrect_answers;
$.each(incorrect_answers, function(i, val){
answers.push(val);
});
shuffle(answers);
addQuestion(question_content, answers);
}
$("#check_exam_btn").css("display", "table");
}
});
};
fetch_questions();
function shuffle(a) {
var j, x, i;
for (i = a.length - 1; i > 0; i--)
{
j = Math.floor(Math.random() * (i + 1));
x = a[i];
a[i] = a[j];
a[j] = x;
}
return a;
}
function addQuestion(question_content, answers)
{
$("#exam_div").append(
'<div class="question" id="'+ question_number +'">'+
'<span class="question_content">'+
question_number + ") " + question_content+
'</span>'+
'<br>'+
'<div class="answers">'+
'</div>'+
'</div>');
addAnswers(question_number, answers);
question_number++;
}
function addAnswers(question_id, answers)
{
var temp = $(this);
$(".question").each(function(){
if($(this).attr("id") == question_id)
temp = $(this);
});
var answers_div = temp.children(".answers");
$.each(answers, function(i, val){
$(answers_div).append(
'<input type="radio" name="question'+ question_id +'">'+
'<span id="radio_answer">'+ val +'</span>'+
'<br>');
});
}
$("#check_exam_btn").click(function(){
$(".question").each(function(){
let id = $(this).attr("id");
let answers = $(this).children(".answers").children("input");
answers.each(function(){
if(($(this).prop("checked")))
{
collected_answers[id] = $(this).next("span").text();
}
});
});
check_result();
});
function check_result()
{
let result = 0;
$.each(questions_answers, function(K, V){
if(collected_answers[K] != V)
result = -1;
});
if(result == 0) //success
{
window.location.href="./joke.html";
localStorage.setItem("hasPermission", 1);
}
else //failed
{
$("#check_exam_btn").hide();
$("#failed_message").slideDown();
$("#exam_div").slideUp();
}
}
$("#same_questions_btn").click(function(){
$("#failed_message").slideUp();
$("#exam_div").slideDown();
$("#check_exam_btn").show();
});
$("#fetch_new_questions").click(function(){
$("#exam_div").html(
'<span id="exam_title">Random questions</span>'+
'<br/><br/>'+
'<div id="loading_fetching"></div>');
question_number = 1;
fetch_questions();
$("#failed_message").slideUp();
$("#exam_div").slideDown();
});
});
</script>
| 36.857143 | 149 | 0.490078 |
3572c5397eaef42e7ae322f76e4563528b9beda9 | 1,987 | sql | SQL | snprc_ehr/resources/source_queries/create_v_snd_Projects.sql | LabKey/snprcEHRModules | 93fab5f8a3ced8f6449a4ed99ae96f513494823f | [
"Apache-2.0"
] | 2 | 2018-11-13T17:29:20.000Z | 2018-11-13T17:29:25.000Z | snprc_ehr/resources/source_queries/create_v_snd_Projects.sql | LabKey/snprcEHRModules | 93fab5f8a3ced8f6449a4ed99ae96f513494823f | [
"Apache-2.0"
] | 36 | 2019-02-27T18:02:47.000Z | 2022-03-30T22:16:03.000Z | snprc_ehr/resources/source_queries/create_v_snd_Projects.sql | LabKey/snprcEHRModules | 93fab5f8a3ced8f6449a4ed99ae96f513494823f | [
"Apache-2.0"
] | 1 | 2019-12-04T16:29:52.000Z | 2019-12-04T16:29:52.000Z | /*
* Copyright (c) 2017-2018 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
ALTER VIEW [labkey_etl].[v_snd_Projects] AS
-- ==========================================================================================
-- Author: Terry Hawkins
-- Create date: 09/27/2017
-- Description: selects the package_category data for the SND integration to snprc_ehr
-- Note:
--
-- Changes:
--
-- 10/22/2019 added logic to transform behavioral projectTypes
-- ==========================================================================================
SELECT
b.budget_id AS ProjectId,
b.revision_num AS RevisionNum,
b.charge_id AS referenceId,
b.start_date_tm AS StartDate,
b.end_date_tm AS EndDate,
case when b.charge_id BETWEEN 6000 AND 6999 then 'B' else b.BUDGET_TYPE end AS ProjectType,
CASE WHEN b.VS_NUM = 0 THEN NULL ELSE b.VS_NUM END AS VsNumber,
b.description as Description,
b.object_id AS objectid,
b.entry_date_tm AS modified,
dbo.f_map_username(b.user_name) AS modifiedby,
tc.created AS created,
tc.createdby AS createdby,
b.timestamp AS timestamp,
CASE WHEN COALESCE(b.end_date_tm, GETDATE()) < GETDATE() THEN 'false' ELSE 'true' END AS Active
FROM dbo.budgets AS b
LEFT OUTER JOIN dbo.TAC_COLUMNS AS tc ON tc.object_id = b.object_id
GO
GRANT SELECT ON [labkey_etl].[v_snd_Projects] TO z_labkey
GO
| 36.127273 | 97 | 0.634122 |
4041c6e6f123c21a46c1126a70fd1fb55224ebe0 | 2,265 | py | Python | examples/breakpoint_api_examples.py | AstrocyteResearch/portformer | 38a3d17fdbf1a7360f260947cfec1b2652e05674 | [
"Apache-2.0"
] | 1 | 2021-08-13T00:15:23.000Z | 2021-08-13T00:15:23.000Z | examples/breakpoint_api_examples.py | AstrocyteResearch/portformer | 38a3d17fdbf1a7360f260947cfec1b2652e05674 | [
"Apache-2.0"
] | 2 | 2020-12-03T09:55:53.000Z | 2020-12-03T15:28:14.000Z | examples/breakpoint_api_examples.py | AstrocyteResearch/portformer | 38a3d17fdbf1a7360f260947cfec1b2652e05674 | [
"Apache-2.0"
] | null | null | null | """Basic Breakpoint API Examples."""
import numpy as np
import pandas as pd
from portformer import BreakpointAPI
def examples():
"""List of major Breakpoint API examples"""
# Read environment variable = BREAKPOINT_API_KEY
api = BreakpointAPI(api_key=None)
# Get Latest AAPL forecasts
breakpoint_forecast = api.forecast("AAPL")
print(
"breakpoint_forecast for {} on {}:\t\tmu:{}, std:{}".format(
breakpoint_forecast["ticker"],
breakpoint_forecast["as_of_date"],
breakpoint_forecast["mu"],
breakpoint_forecast["std"],
)
)
# Get Historical TSLA forecasts
historical_breakpoints = api.historical_forecasts(
"TSLA", start_date="2020-02-01", end_date="2020-04-01"
)
print(
"number of historical_breakpoints:\t\t\t{}".format(
len(historical_breakpoints["agg"])
)
)
# Get Latest SPY AGG GLD forecasts
breakpoint_cross_section = api.cross_sectional_forecasts(
tickers=["SPY", "AGG", "GLD"]
)
print(
"breakpoint_cross_section forecasted sharpe ratios:\t",
{x["ticker"]: x["sharpe"] for x in breakpoint_cross_section},
)
# Get Latest Bitcoin forecasts
btc = api.crypto_forecasts(ticker="BTCUSD")
print(
"BTCUSD for {} on {}:\t\t\tmu:{}, std:{}".format(
btc["ticker"], btc["as_of_date"], btc["mu"], btc["std"],
)
)
# Get Crypto Universe Bitcoin forecasts
universe = api.crypto_universe()
print("number of crypto tickers in universe:\t\t\t{}".format(len(universe)))
def custom_examples():
"""API request with custom timeseries data"""
# Read environment variable = BREAKPOINT_API_KEY
api = BreakpointAPI(api_key=None)
N = 200
seed = 42
# Generate a random price series
np.random.seed(seed)
data = np.exp(pd.Series(np.random.normal(size=(N,)) * 0.01).cumsum())
data.index = pd.bdate_range("2020-01-01", periods=N)
bp = api.custom_timeseries_forecasts(
data,
name=None,
history_timedelta=None,
tform="log-diff",
no_whitten=False,
seed=seed,
)
print(bp)
if __name__ == "__main__":
# examples()
custom_examples()
| 26.647059 | 80 | 0.621634 |
a6ec2549630a7960576757421fd1f3499d4a2d6d | 621 | swift | Swift | Authenticator/Settings/Alternate Icons/AppIconService.swift | BastiaanJansen/Authenticator | 749c48aaa43130eac89db06c84c1afdd11b98eaa | [
"MIT"
] | 2 | 2021-02-04T21:22:02.000Z | 2021-05-15T14:07:38.000Z | Authenticator/Settings/Alternate Icons/AppIconService.swift | BastiaanJansen/Authenticator | 749c48aaa43130eac89db06c84c1afdd11b98eaa | [
"MIT"
] | null | null | null | Authenticator/Settings/Alternate Icons/AppIconService.swift | BastiaanJansen/Authenticator | 749c48aaa43130eac89db06c84c1afdd11b98eaa | [
"MIT"
] | null | null | null | //
// AppIconService.swift
// Authenticator
//
// Created by Bastiaan Jansen on 08/12/2020.
//
import UIKit
class AppIconService {
enum AppIcon: String, CaseIterable {
case indigo = "IndigoIcon"
case black = "BlackIcon"
case darkPlum = "DarkPlumIcon"
}
static func changeIcon(to icon: AppIcon) {
let name: String? = icon == .indigo ? nil : icon.rawValue
UIApplication.shared.setAlternateIconName(name, completionHandler: { error in
if let error = error {
print(error.localizedDescription)
}
})
}
}
| 23 | 85 | 0.594203 |
404ce2bca0f18b2df64f575b49eb0c3ce6729b52 | 7,630 | py | Python | webware/MiscUtils/Tests/TestFuncs.py | PeaceWorksTechnologySolutions/w4py3 | 7f9e7088034e3e3ac53158edfa4f377b5b2f45fe | [
"MIT"
] | 11 | 2020-10-18T07:33:56.000Z | 2021-09-27T21:03:38.000Z | webware/MiscUtils/Tests/TestFuncs.py | PeaceWorksTechnologySolutions/w4py3 | 7f9e7088034e3e3ac53158edfa4f377b5b2f45fe | [
"MIT"
] | 9 | 2020-01-03T18:58:25.000Z | 2020-01-09T18:36:23.000Z | webware/MiscUtils/Tests/TestFuncs.py | PeaceWorksTechnologySolutions/w4py3 | 7f9e7088034e3e3ac53158edfa4f377b5b2f45fe | [
"MIT"
] | 4 | 2020-06-30T09:41:56.000Z | 2021-02-20T13:48:08.000Z | import time
import unittest
from MiscUtils.Funcs import (
asclocaltime, commas, charWrap, wordWrap, excstr,
hostName, localIP, localTimeDelta, positiveId,
safeDescription, timestamp, uniqueId, valueForString)
class TestFuncs(unittest.TestCase):
"""Unit tests for the functions in MiscUtils.Funcs."""
def testCommas(self):
testSpec = '''
0 '0'
0.0 '0.0'
1 '1'
11 '11'
111 '111'
1111 '1,111'
11111 '11,111'
1.0 '1.0'
11.0 '11.0'
1.15 '1.15'
12345.127 '12,345.127'
-1 '-1'
-11 '-11'
-111 '-111'
-1111 '-1,111'
-11111 '-11,111'
'''
tests = testSpec.split()
count = len(tests)
i = 0
while i < count:
source = eval(tests[i])
result = eval(tests[i+1])
self.assertEqual(commas(source), result)
# also try the source as a string instead of a number
source = eval(f"'{tests[i]}'")
self.assertEqual(commas(source), result)
i += 2
def testCharWrap(self):
self.assertEqual(charWrap("""
Sparse is better than dense.
Readability counts.""", 34, 16), """
Sparse is better than
dense.
Readability counts.""")
def testWordWrap(self):
# an example with some spaces and newlines
msg = '''Arthur: "The Lady of the Lake, her arm clad in the purest \
shimmering samite, held aloft Excalibur from the bosom of the water, \
signifying by Divine Providence that I, Arthur, was to carry \
Excalibur. That is why I am your king!"
Dennis: "Listen. Strange women lying in ponds distributing swords is \
no basis for a system of government. Supreme executive power derives \
from a mandate from the masses, not from some farcical aquatic ceremony!"'''
for margin in range(20, 200, 29):
if margin == 78:
s = wordWrap(msg)
else:
s = wordWrap(msg, margin)
for line in s.splitlines():
self.assertLessEqual(
len(line), margin,
f'len={len(line)}, margin={margin}, line={line!r}')
self.assertEqual(msg.split(), s.split())
def testExcstr(self):
self.assertEqual(excstr(None), None)
self.assertEqual(
excstr(ValueError('Kawoom!')), 'ValueError: Kawoom!')
def testHostName(self):
# About all we can do is invoke hostName() to see that no exceptions
# are thrown, and do a little type checking on the return type.
host = hostName()
self.assertIsNotNone(host)
self.assertIsInstance(host, str)
self.assertEqual(host, host.lower())
def testLocalIP(self):
ip = localIP()
self.assertTrue(ip)
self.assertFalse(ip.startswith('127.'))
self.assertEqual(localIP(), ip) # second invocation
self.assertEqual(localIP(useCache=None), ip)
# ignore if the following tests fetch the WSL address
ips = (ip, '192.168.80.1', '172.25.112.1')
self.assertIn(
localIP(remote=None, useCache=None), ips,
'See if this works: localIP(remote=None).'
' If this fails, dont worry.')
self.assertIn(
localIP(remote=('www.hostname.and.domain.are.invalid', 80),
useCache=None), ips)
def testPositiveId(self):
# About all we can do is invoke positiveId()
# to see that no exceptions are thrown and the result is positive.
self.assertIsInstance(positiveId(self), int)
self.assertGreater(positiveId(self), 0)
def testSafeDescription(self):
desc = safeDescription
# basics:
s = desc(1).replace('type=', 'class=')
self.assertEqual(s, "what=1 class=<class 'int'>")
s = desc(1, 'x').replace('type=', 'class=')
self.assertEqual(s, "x=1 class=<class 'int'>")
s = desc('x').replace('type=', 'class=')
s = s.replace("<type 'string'>", "<class 'str'>")
self.assertEqual(s, "what='x' class=<class 'str'>")
class Dummy:
pass
s = desc(Dummy())
self.assertIn('Dummy object', s, repr(s))
# okay now test that safeDescription eats exceptions from repr():
class Bogus:
def __repr__(self):
raise KeyError('bogus')
b = Bogus()
try:
s = desc(b)
except Exception:
s = 'failure: should not throw exception'
self.assertIn("(exception from repr(obj): KeyError: 'bogus')", s)
def testAsclocaltime(self):
self.assertEqual(len(asclocaltime()), 24)
t = time.time()
self.assertEqual(asclocaltime(t), time.asctime(time.localtime(t)))
def testTimestamp(self):
d = timestamp()
self.assertIsInstance(d, dict)
self.assertEqual(','.join(sorted(d)), 'condensed,dashed,pretty,tuple')
self.assertEqual(len(d['tuple']), 6)
self.assertEqual(len(d['condensed']), 14)
self.assertEqual(len(d['pretty']), 19)
self.assertEqual(len(d['dashed']), 19)
t = time.time()
d = timestamp(t)
t = time.localtime(t)[:6]
self.assertEqual(d['tuple'], t)
self.assertEqual(
d['condensed'], '{:4d}{:02d}{:02d}{:02d}{:02d}{:02d}'.format(*t))
self.assertEqual(
d['condensed'],
d['pretty'].replace('-', '').replace(':', '').replace(' ', ''))
self.assertEqual(d['condensed'], d['dashed'].replace('-', ''))
def testLocalTimeDelta(self):
d = localTimeDelta()
self.assertEqual(d.microseconds, 0)
self.assertEqual(d.seconds % 3600, 0)
self.assertTrue(-1 <= d.days < 1)
d = localTimeDelta(time.time())
self.assertEqual(d.microseconds, 0)
self.assertEqual(d.seconds % 3600, 0)
self.assertTrue(-1 <= d.days < 1)
def testUniqueId(self):
past = set()
def checkId(i):
self.assertIsInstance(i, str, type(i))
self.assertEqual(len(i), 32)
for c in i:
self.assertTrue(c in '0123456789abcdef')
self.assertFalse(i in past)
past.add(i)
for n in range(10):
checkId(uniqueId())
checkId(uniqueId(None))
checkId(uniqueId(n))
checkId(uniqueId(forObject=checkId))
def testValueForString(self):
evalCases = '''
1
9223372036854775808
5.5
True
False
None
[1]
['a']
{'x':1}
(1, 2, 3)
'a'
"z"
"""1234"""
'''
stringCases = '''
kjasdfkasdf
2389234lkdsflkjsdf
*09809
'''
evalCases = [s.strip() for s in evalCases.strip().splitlines()]
for case in evalCases:
value = valueForString(case)
evalCase = eval(case)
self.assertEqual(
value, evalCase,
f'case={case!r}, valueForString()={value!r},'
f' eval()={evalCase!r}')
stringCases = [s.strip() for s in stringCases.strip().splitlines()]
for case in stringCases:
value = valueForString(case)
self.assertEqual(
value, case,
f'case={case!r}, valueForString()={value!r}')
| 33.318777 | 78 | 0.536435 |