是否可以将参数传递给选择节点的CTE,然后选择其父节点到parentId空的根节点?
在我的下面的代码中,如果我传入一个选择Rain Coats的参数,然后将树递归到男士服装,其中它parentId为null并选择该分支中的所有节点,包括子节点.请有人帮我这个.我的例子只是递归并显示深度
SQL示例:
DECLARE @Department TABLE
(
Id INT NOT NULL,
Name varchar(50) NOT NULL,
ParentId int NULL
)
INSERT INTO @Department SELECT 1, 'Toys', null
INSERT INTO @Department SELECT 2, 'Computers', null
INSERT INTO @Department SELECT 3, 'Consoles', 2
INSERT INTO @Department SELECT 4, 'PlayStation 3', 3
INSERT INTO @Department SELECT 5, 'Xbox 360', 2
INSERT INTO @Department SELECT 6, 'Games', 1
INSERT INTO @Department SELECT 7, 'Puzzles', 6
INSERT INTO @Department SELECT 8, …Run Code Online (Sandbox Code Playgroud) 我一直在尝试在全局asax中的Application_Start事件上获取我的项目的应用程序路径我可以在未路由的页面上使用server.mappath但是当我在路由页面上时我得到新的虚拟路径在那里一种在启动时获取应用程序路径的方法我无法在该级别使用Request或session或HttpContext.items [key]有没有人知道该怎么做
对于与问题模型相关的评论,我有一个 morphMany 关系,我想知道在保存新评论模型时如何获取新插入的 ID。
public function postComment() {
if(Request::ajax() && Auth::check()) {
//Input::merge(array_map('trim', Input::all()));
$comment = new Comment;
$comment->user_id = Auth::user()->id;
$comment->body = Helper::strip_tags(Input::get('body'));
$question_id = Input::get('question_id');
$question = Question::find($question_id);
// here in the if statement how do I get the newly created id of a comment
if($question->comments()->save($comment)) {
return Response::json(array('success' => true, 'body' => Input::get('body'),
'userlink' => HTML::linkRoute('profile', Auth::user()->username, array('id' => Auth::user()->id)), 'date' => date("F j, Y, g:i a") ));
} else {
return Response::json(array('success' => false, 'body' => …Run Code Online (Sandbox Code Playgroud) 我不知道从哪里开始,但是我想要或需要的是HTMLElement的包装函数,所以我不扩展HTMLElement类,而是扩展自己的对象,然后检查类,以查看元素是否具有类等,但是我代码根本不起作用,它说$(...)。hasClass不是一个函数
$ = function(a, b) {
this.$el = document.querySelector(a);
return this;
}
Object.assign($.prototype, {
hasClass: function(selector) {
return this.$el.classList.contains(selector);
}
})
console.log($('#list').hasClass('list'));
Run Code Online (Sandbox Code Playgroud) 有人可以告诉我两者之间的区别
static public
public static
Run Code Online (Sandbox Code Playgroud)
和
private int _myin = 0
public int MyInt
{
get{ return _myInt; }
private set {_myInt = value; }
}
Run Code Online (Sandbox Code Playgroud)
私人设定部分是我想知道的
有人可以解释覆盖默认属性,甚至在我的插件示例中使用jQuery扩展它们以及闭包函数
$.fn.myObject = function(overwriteProperties) {
var properties = {myproperty1: "defaultvalue"}
// overwrite properties here
function doStuffHere() {
}
return (function() {
return this; // does this part here refer to the object of myDiv
});
}
$('#myDiv').myObject({myPoperty1:"newValue"});
Run Code Online (Sandbox Code Playgroud) 有没有人知道偏移div前排的前两个s,它们的类col-3-12具有偏移量offset-6-12并且offset-9-12位于我的网格系统的右侧jsFiddle
CSS:
body {
font:20px/1.2 Verdana, Arial; padding:0px; margin:0px;
}
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing:border-box;
}
.container {
padding: 20px 20px 0 20px; background-color: red
}
.row {
padding: 0;
*zoom: 1;
}
.row:after, .row:before {
content: ' ';
display: table;
}
.row:after {
clear: both;
}
.row > [class*='col-']:first-child {
margin-left: 0;
}
.row > [class*='col-']:last-child {
margin-right: 0;
}
.row > [class*='col-'] {
/* edit …Run Code Online (Sandbox Code Playgroud) 如何在调用actor关系数据时隐藏数据透视表数据我想在调用时隐藏的列是包含"movie_id"和"person_id"的"pivot"
class Movie extends Model
{
protected $table = 'movies';
protected $hidden = array('pivot'); // doesn't work
protected $fillable = [
'adult',
'tmdb_id',
'imdb_id',
'release_date',
'original_language',
'original_title',
'title',
'popularity',
'backdrop_path',
'poster_path',
'runtime',
'tagline',
'trailer',
'summary'
];
public function persons() {
return $this->belongsToMany('App\Person', 'movies_pivot', 'movie_id', 'person_id');
}
public function actors() {
return $this->persons()->wherePivot('job_title', '=', 'Actor')->select('movies_pivot.job_title', 'persons.id', 'persons.name', 'persons.profile_path');
}
}
Run Code Online (Sandbox Code Playgroud)
返回的数据:
"actors": [
{
"job_title": "Actor",
"id": 1,
"name": "Jaquan Nicolas",
"profile_path": "asd",
"pivot": {
"movie_id": 1,
"person_id": 1
}
},
Run Code Online (Sandbox Code Playgroud) 我一直在搜索google,但没有关于此问题的答案或文章。我想创建一个六边形网格,但我需要半色调图案,因此在该图案中可能需要多个六角形。下面的代码生成六边形的图案,但不是半色调图案。我需要半色调图案才能水平移动。我有Adobe的半色调图案的此链接,但网格太小且垂直,但我希望水平。这是我在codepen上制作的六边形网格的链接。有人可以告诉我使六边形的图案水平成半色调图案吗?
html, body {
height: 100%;
margin: 0;
padding: 0;
background: black;
}
svg {
background: rgb(125, 155, 132);
}
polygon {
fill: rgb(125, 155, 132);
stroke-width: 1;
stroke: #000;
}Run Code Online (Sandbox Code Playgroud)
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%">
<defs>
<pattern id="hexagons" width="50" height="43.4"
patternUnits="userSpaceOnUse"
patternTransform="scale(2)">
<polygon
points="24.8,22 37.3,29.2 37.3,43.7 24.8,50.9 12.3,43.7 12.3,29.2"
id="hex" shape-rendering="geometricPrecision" />
<use xlink:href="#hex" x="25" />
<use xlink:href="#hex" x="-25" />
<use xlink:href="#hex" x="12.5" y="-21.7" />
<use xlink:href="#hex" x="-12.5" y="-21.7" />
</pattern>
</defs>
<rect width="100%" height="100%" …Run Code Online (Sandbox Code Playgroud)css ×3
html ×3
javascript ×3
jquery ×3
asp.net ×2
c# ×2
laravel ×2
php ×2
css3 ×1
grid-system ×1
laravel-4 ×1
sql ×1
sql-server ×1
svg ×1