我正在做一个电子商务项目,并对存储产品的数据库设计感到困惑.我推测有三种方法可以制作数据库:
1.每个产品类别可以有单独的表格.
Table: Categories
------------------
cat_ID
cat_name
Table: Sub_Categories
---------------------
sub_cat_ID
categories_cat_ID
sub_cat_name
Table: Books
-------------
book_ID
sub_categories_sub_cat_ID
book_title
book_author
book_ISBN
book_price
etc
Table: Clothes
---------------
clothes_ID
sub_categories_sub_cat_ID
clothes_name
clothes_color
clothes_size
clothes_description
clothes_price
etc
Table: Perfumes
----------------
perfumes_ID
sub_categories_sub_cat_ID
perfume_name
perfume_size
perfume_weight
perfume_description
perfume_price
etc
Run Code Online (Sandbox Code Playgroud)
2.将所有产品组合在一个表中,并允许某些值为空
Table: Categories
------------------
cat_ID
cat_name
Table: Sub_Categories
---------------------
sub_cat_ID
categories_cat_ID
sub_cat_name
Table: Products
---------------
product_ID
sub_categories_sub_cat_ID
title
description
price
author (can be null for everything except books)
size
weight (can be null for everything …Run Code Online (Sandbox Code Playgroud) 我收到一个错误说:
failed to clone https://github.com/php-fig/log.git, git was not found, check that it is installed and in your PATH env.
'git' is not recognized as and internal or external command, operable program or batch file
Run Code Online (Sandbox Code Playgroud)
当我试着跑composer create-project laravel/laravel learning-laravel.
我安装了git GUI,它还带有命令行shell,但我不知道为什么它不能识别命令(我在正常的Windows命令行提示符下发出了create-project命令).
我也尝试从git shell运行命令,但是当我尝试时php artisan serve它给了我一个错误,说CLI已经停止工作了.
有谁知道如何修复git错误?我宁愿使用windows命令shell而不是git one,因为它可以进入我的wamp/www文件
我在任何地方都尝试过学习并设法解决这个问题,但是我什么也没得到。
让我们取一个字符串:
蛋白杏仁饼干甜点松饼。糖李子饼干杏仁饼蛋奶酥棒棒糖糖果布朗尼提拉米苏牛角包。威化饼干冰淇淋巧克力软糖。芝士蛋糕粉chupa chups。甜甜圈糕点糖果手杖。甘草软糖卷糖果棒果冻-o。芝麻snap花糖梅蛋糕苹果派。巧克力冰淇淋棉花糖蛋奶酥。苹果派丹麦菜unerdwear.com薄饼unerdwear.com松饼涂抹布丁。果冻棉花糖布朗尼棒棒糖蛋白杏仁饼干甜卷胡萝卜蛋糕巧克力棒。酸的棒棒糖饼干unerdwear.com软糖粉。果冻酥糖苹果派布丁焦糖小杏仁饼。小杏仁饼果冻-O型浇头派粉糖衣。软糖果冻o提拉米苏熊爪布朗尼芝士蛋糕。糖霜燕麦蛋糕棒棒糖胡萝卜蛋糕太妃糖。甜甜圈果冻糖梅花松饼。水果蛋糕提拉米苏枣松饼蛋j果冻派水果蛋糕。Unerdwear.com枣unerdwear.com gummi熊软糖布朗尼杏仁饼。小杏仁饼酥糖蛋糕tootsie卷棉花糖棉花糖甜甜圈。Soufflé威化棒棒糖胡萝卜糕。芝士蛋糕松饼粉软糖胡萝卜蛋糕。酥油冰淇淋应用甘草杏仁饼苹果派蛋糕。蛋糕糖衣甘草。糖李子饼干酥糖。胡萝卜糕棒棒糖甜糖果。糖果棒小杏仁饼棉花糖丹麦蛋糕果冻-o布朗尼饼干燕麦蛋糕。蛋糕糖衣甘草。糖李子饼干酥糖。胡萝卜糕棒棒糖甜糖果。糖果棒小杏仁饼棉花糖丹麦蛋糕果冻-o布朗尼饼干燕麦蛋糕。蛋糕糖衣甘草。糖李子饼干酥糖。胡萝卜糕棒棒糖甜糖果。糖果棒小杏仁饼棉花糖丹麦蛋糕果冻-o布朗尼饼干燕麦蛋糕。
当我做:
Encode::encode('UTF-8', $text);
Run Code Online (Sandbox Code Playgroud)
在该字符串上,单词Soufflé被编码为Soufflé。
当我看到它时,我不会将其识别为任何代码点或任何有效的编码映射(即é)。我如何期望它以正确读取的方式到达目的地?换句话说,当我将Perl编码为UTF8时,为什么Perl会给我é é?
xmlbody($text);
sub xmlbody {
$description = shift;
use XML::Writer;
my $writer = XML::Writer->new( OUTPUT => 'self', ENCODING => 'utf-8' );
my $writer->xmlDecl('utf-8');
## ...structure
$writer->cdataElement('description',$description);
## ...more structure
$writer->end();
}
Run Code Online (Sandbox Code Playgroud)
use utf8;似乎没有在上述字符串中编码特殊字符,它仍然给出“Ô。因为我没有使用filehandle或stdin / stdout,所以会$writer->xmlDecl('utf-8')等同于use open qw(:std :utf8)吗?
我尝试过以下方法:
<a href="#" class='aclass'>Fires an event</a> //pops back up to page, not nice
<a href="" class='aclass'>Fires an event</a> //refreshes the page, not nice
<a type="button" class='aclass'>Fires an event</a> //does nothing but the event, good!
Run Code Online (Sandbox Code Playgroud)
只是想知道将带有值按钮的类型属性添加到锚标记在语义上是否可以接受,因为我不记得曾经这样做过,但也许它现在发生并且实际上起作用了。
我正在尝试从 XML 元素中获取值,并使用 linq 命令将其转换为整数,以便我可以使用它执行一些数学方程。
到目前为止,这就是我尝试过的方法:
private void buttonTab4Mod1Calculate_Click(object sender, EventArgs e)
{
var document = XDocument.Load(workingDir + @"\Level4.xml");
var assessmentOneWeight = from d in document.Descendants("moduleTitle")
where d.Value == (String)comboBoxTab4Mod8.SelectedItem
select d.Parent.Element("assessmentOneWeight").Value;
int a = 0;
foreach (var item in assessmentOneWeight)
{
a = Convert.ToInt32(item);
}
MessageBox.Show(a.ToString());
}
Run Code Online (Sandbox Code Playgroud)
但由于某种原因该值仍然是 0。
这是我的 xml 文件:
<?xml version="1.0" encoding="utf-8" ?>
<SoftwareEngineering>
<Module>
<moduleCode>ECSE401</moduleCode>
<moduleTitle>Programming Methodology</moduleTitle>
<credits>15</credits>
<assessmentOne>Coursework</assessmentOne>
<assessmentOneWeight>40</assessmentOneWeight>
<assessmentTwo>Coursework</assessmentTwo>
<assessmentTwoWeight>40</assessmentTwoWeight>
<assessmentThree>Test</assessmentThree>
<assessmentThreeWeight>20</assessmentThreeWeight>
</Module>
<Module>
<moduleCode>ECSC404</moduleCode>
<moduleTitle>Computer Systems Fundamentals</moduleTitle>
<credits>15</credits>
<assessmentOne>Test1</assessmentOne>
<assessmentOneWeight>30</assessmentOneWeight>
<assessmentTwo>Test2</assessmentTwo>
<assessmentTwoWeight>30</assessmentTwoWeight> …Run Code Online (Sandbox Code Playgroud) 我正在制作一个我计划在CPAN上分发的模块,这是一个公共API的客户端库.
API需要API凭据(client_id/secret),我不确定在为具有此类凭据的分发运行Perl测试方面最佳做法是什么.
我是:
我有一个数组,我传递给TT文件,用于填充导航栏.
我正在使用主模板作为主体内容的基础和子模板.
我想知道是否可以声明'主模板应该总是接收这个数组',而不是每次加载视图时都必须传递这个数组(哦,是的,我正在使用Dancer btw:P),ex :
get '/' => sub {
template 'index', { for_all_i_know => $this_never_changes }
}
get '/about' => sub {
template 'about', { for_all_i_know => $this_never_changes }
}
Run Code Online (Sandbox Code Playgroud)
而不是那样做,有没有办法清理它?就像是:
bind template 'main' { for_all_i_know => $this_never_changes };
Run Code Online (Sandbox Code Playgroud)
那样我就可以这样做:
get '/' => sub {
template 'index';
}
Run Code Online (Sandbox Code Playgroud)
并且主模板仍会加载变量'for_all_i_know'
使用最新的Ember(3.2),ember-cli-mirage 0.4.7,ember-cli-qunit 4.3.2,ember-qunit 3.4.1
我正在使用ember-cli-mirage来尝试前端测试,我无法解决这个错误:
Uncaught TypeError: template.getProperties is not a function
Run Code Online (Sandbox Code Playgroud)
我在组件测试中运行它:
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
module('Integration | Component | template-editor', function(hooks) {
setupRenderingTest(hooks);
setupMirage(hooks);
test('it renders', async function(assert) {
const mockTemplate = server.create('template');
this.set('mockTemplate', mockTemplate);
await render(hbs`{{template-editor template=mockTemplate}}`);
assert.equal(this.get('template.name'), 1);
});
});
Run Code Online (Sandbox Code Playgroud)
我的组件JS文件的相关部分是这样的:
export default Component.extend({
init () {
this._super(...arguments);
let template = this.get('template');
if …Run Code Online (Sandbox Code Playgroud) 假设用户回答数学问题,然后他继续回答下一个问题.你用什么语句来清空EditText?
即1 + 1 = 2,2当方程现在为3 + 3时,2仍然在EditText中.
如果我没有说清楚,请告诉我.
我正在使用表单来显示XML元素.每次我点击列表框中的模块时,我想<Code>在表单上的标签中显示其值.我遇到的问题是,我所做的就是XML被一次性读取,而我无法或不知道如何在我的XML文件中搜索.所以我想我只需要一种搜索XML来查找<Code>元素的方法.
编辑:<Code>当我匹配<Name>列表框中的元素时,我试图在标签中显示元素的程度如下:
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
var document = XDocument.Load(workingDir + @"\ModulesList.xml");
var code = from d in document.Descendants("Name")
where d.Value == listBox1.SelectedItem.ToString()
select d.Parent.Element("Code").Value;
labelCodeNumber.Text = code.ToString();
}
Run Code Online (Sandbox Code Playgroud)
但问题是labelCodeNumber没有显示值code,而是显示了一些奇怪的集合.另外我不确定我是否正在输出正确的ielabelCodeNumber.Text = code.ToString();
这是XML:
<?xml version="1.0" encoding="utf-8" ?>
<SoftwareEngineering>
<Module>
<Name>Algorithms and Data Structures</Name>
<Code>3SFE504</Code>
<Capacity>5</Capacity>
<Semester>1</Semester>
<Prerequisite>none</Prerequisite>
</Module>
<Module>
<Name>3D Graphics I</Name>
<Code>3SFE508</Code>
<Capacity>5</Capacity>
<Semester>1</Semester>
<Prerequisite>none</Prerequisite>
</Module>
<Module>
<Name>Event-Driven Programming</Name>
<Code>3SFE513</Code>
<Capacity>10</Capacity>
<Semester>1</Semester>
<Prerequisite>none</Prerequisite>
</Module>
<Module> …Run Code Online (Sandbox Code Playgroud) c# ×2
perl ×2
android ×1
composer-php ×1
dancer ×1
e-commerce ×1
ember.js ×1
git ×1
html ×1
java ×1
laravel-4 ×1
linq-to-xml ×1
mysql ×1
php ×1
unit-testing ×1
xml ×1