我发现ChromePhp可以帮助我调试PHP并安装相关的Chrome插件,但我似乎无法让它工作.我最初将它放在我重定向的htdocs的一个文件夹中,并将其添加到xampp的php.ini中的PHP路径中:
; Windows: "\path1;\path2"
include_path = ".;C:\xampp\php\PEAR;D:\htdocs\includes"
Run Code Online (Sandbox Code Playgroud)
这似乎没有用,每当我试图包含文件并输出一个时,我就会像下面那样得到错误 ChromePhp::log("message")
警告:无法修改标头信息 - 已在D:\ htdocs\ask.ca\wp-includes \中发送的标头(在D:\ htdocs\ask.ca\wp-admin\menu-header.php:91处开始输出)第385行的ChromePhp.php
那么我在我的Windows路径中尝试了类似的方法,结果相同.
最后我完全是本地的,并试图将ChromePhp.php文件包含在我的插件中,使用:
include( dirname(__FILE__) . '/php/ChromePhp.php' );
ChromePhp::log("Hello World");
Run Code Online (Sandbox Code Playgroud)
但我仍然得到同样的错误??? 任何人都可以解释ABC让ChromePhp工作吗?我之所以说ABC,显然即使我阅读了ChromePhp的网站说明(和其他人一起工作以使其发挥作用),这些指示非常简短,我认为很简单,我仍然需要更多的芝麻街解释.
我正在尝试插入一个插入,如果它id已经存在,它会更新行,但我似乎无法让它工作.
这是插入的简化版本,因为可以插入/更新大约1400行.大多数情况下,该语句将充当多行UPDATE,每天将通过CRON作业运行.它应该更新现有的行,但如果添加了新项,则会将其插入数据库.
INSERT INTO `buoy_stations` (`id`, `coords`, `name`, `owner`, `pgm`, `met`, `currents`)
VALUES
('00922', Point(30,-90),'name 1','owner 1','pgm 1','y','y'),
('00923', Point(30,-90),'name 2','owner 2','pgm 2','y','y'),
('00924', Point(30,-90),'name 3','owner 3','pgm 3','y','y'),
('00925', Point(30,-90),'name 4','owner 4','pgm 4','y','y'),
('00926', Point(30,-90),'name 5','owner 5','pgm 5','y','y')
ON DUPLICATE KEY
UPDATE coords=coords, name=name, owner=owner, pgm=pgm, met=met, currents=currents;
Run Code Online (Sandbox Code Playgroud)
我做错了什么,这不起作用?它似乎必须在UPDATE基于错误的部分中.
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to …Run Code Online (Sandbox Code Playgroud) 我正在慢慢地学习如何使用 D3,但已经在我的第一个图表中我无法弄清楚为什么 x 轴位于顶部而不是底部。我已经设置了 orient('bottom') 并通过左边距和顶部边距进行了翻译,并且它相对于翻译正确定位,但它出现在条形图的顶部。任何人都可以看到问题是什么?该代码看起来与一堆示例相似,所以我不确定为什么它不能正常工作。
// Ordinal scale to transform data to fit width of the chart
// -- NOTE: ordinal is equivalent to an ordered list
xScale = d3.scale.ordinal()
.domain(d3.range(0, data.length))
.rangeBands([0, config.width],
config.rangeBandPadding,
config.rangeBandOuterPadding);
// Quantitative linear scale to transform data to fit height of the chart
// -- NOTE: quantitative is equivalent to an unordered list
yScale = d3.scale.linear()
.domain([0, d3.max(data)])
.range([0, config.height]);
// Create the <svg> canvas with chart group
svg = D3Service.getSvgCanvas($element[0],
config.outerWidth,
config.outerHeight, …Run Code Online (Sandbox Code Playgroud) 我正在尝试更新 auser和之间的关系user_profile。我可以更新用户,但是当我尝试更新以下内容时,我不断收到此错误user_profile:
ERROR: Error: UserProfile.relationMappings.user: modelClass is not defined
据我所知,我已经模仿了文档和 TypeScript 示例中的示例,但是谁能看出为什么这不起作用?
我包括了查询、模型和用户配置文件迁移。BaseModel 的内容被注释掉了,相当于直接从 Model 继承了,并且jsonSchema只用于验证,所以为了简洁起见我把它们去掉了。
更新
删除relationshipMappingsfrom 会UserProfile阻止错误发生,但由于我需要这种BelongsToOneRelation关系,我仍在尝试。至少它似乎缩小到relationMappings了UserProfile.
询问
const user = await User.query() // <--- Inserts the user
.insert({ username, password });
const profile = await UserProfile.query() <--- Throws error
.insert({ user_id: 1, first_name, last_name });
Run Code Online (Sandbox Code Playgroud)
楷模
import { Model, RelationMappings } from 'objection';
import { BaseModel } from './base.model'; …Run Code Online (Sandbox Code Playgroud) 作为第一步,我们正在构建一个门户来替换部分现有应用程序,但数据库模式完全不遵循任何约定。除了缺乏任何约束、索引等之外,列的名称不是描述性的,也不是蛇形的。
是否可以映射数据库表列名称,以便门户使用正确的描述性和蛇形列名称,first_name但写入实际的数据库列first,至少让门户成为清理技术债务的第一步?
例如,Model::table如果表名不遵循约定,则类似于如何设置表名 ( ):
例子
private $columns = [
// convention => actual
'first_name' => 'first',
'last_name' => 'last',
'mobile_phone' => 'phone',
'home_phone' => 'otherPhone', // seriously!?
];
Run Code Online (Sandbox Code Playgroud)
我已经研究过Model这个HasAttributes特征,但我仍然希望这可能存在,或者有人找到了一种方法来做到这一点作为临时解决方案。
route.snapshot.data是否可以从 Angular 14 中的routeConfig中读取标题?我可以在route.snapshot.data作为Symbol中看到它,但似乎无法访问它:
{
path: 'example',
title: 'Title of Page',
component: ExamplePage
}
Run Code Online (Sandbox Code Playgroud)
this.route.snapshot.data[Symbol('RouteTitle')]) // undefined
console.log(this.route.snapshot.data) // { Symbol('RouteTitle'): 'Title of Page' }
Run Code Online (Sandbox Code Playgroud)
我正在使用 TitleStrategy 将标题更新为:
${title} | ${companyName}`
Run Code Online (Sandbox Code Playgroud)
但希望获取组件中的预策略标题以在页面中使用,以便它们匹配,而无需每次使用Title服务getTitle和切片。companyName
这是尝试通过使用包含以下内容的SQL转储移植旧项目来学习Laravel(特别是v5.x):
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`locationid` int(11) NOT NULL,
`username` varchar(45) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`email` varchar(200) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`firstname` varchar(100) NOT NULL,
`lastname` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`active` bit(1) DEFAULT b'1',
`token` varchar(100) DEFAULT NULL,
`token_created` timestamp NULL DEFAULT NULL,
`role` varchar(45) NOT NULL DEFAULT 'user',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `email_UNIQUE` (`email`),
UNIQUE …Run Code Online (Sandbox Code Playgroud) 我认为通过实例化一个pattern = new RegExp()并传递一个字符串然后使用.test(value)将与使用/^...$/.test(value)相同,但它们似乎不是等于使用RegExp并且每次传递字符串失败.这不正确吗?在MDN上似乎可以说这应该有效.
应该全部失败,他们做
var str = "7D>";
var res = /^[A-Za-z0-9\d=!\-@._*]*$/.test(str);
console.log(res); // false which is correct
var patt = /^[A-Za-z0-9\d=!\-@._*]*$/;
var res = patt.test(str);
console.log(res); // false which is correct
var patt = new RegExp("/^[A-Za-z0-9\d=!\-@._*]*$/");
var res = patt.test(str);
console.log(res); // false which is correct, but suspicious based on follow results
Run Code Online (Sandbox Code Playgroud)
应该全部通过而他们不要
var str = "7D";
var res = /^[A-Za-z0-9\d=!\-@._*]*$/.test(str);
console.log(res); // true which is correct
var patt = /^[A-Za-z0-9\d=!\-@._*]*$/;
var res = patt.test(str);
console.log(res); …Run Code Online (Sandbox Code Playgroud) javascript ×2
laravel ×2
mysql ×2
php ×2
angular ×1
chromephp ×1
d3.js ×1
database ×1
laravel-5 ×1
laravel-5.6 ×1
node.js ×1
objection.js ×1
regex ×1
xampp ×1