这可能很容易,但我无法弄明白.我已经搜索了几个小时但没有运气我的情况.我需要分页才能使用my_query
<?php
$count = 0;
$id_suffix = 1;
$items_per_row = 4;
$quality = 90;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$wp_query = new WP_Query( array( 'posts_per_page' => '4', 'post_type' => 'portfolio') );
$grid_class = 'grid_3';
$desired_width = 220;
$desired_height = 190;
$terms = get_terms( 'portfolio_categories' );
$count_terms = count( $terms );
?>
//some php code
<?php while ( $wp_query -> have_posts()) : $wp_query -> the_post(); //query the "portfolio" custom post type for portfolio items ?>
//some more php code …
Run Code Online (Sandbox Code Playgroud) 正如我们可以从vim中的文件开头删除(或替换,或者猛拉等)第4到第6行:
:4,6d
Run Code Online (Sandbox Code Playgroud)
我想从文件末尾删除(或替换,或者猛拉等)第4行到第6行.这意味着,如果文件有15行,我会这样做:
:10,12d
Run Code Online (Sandbox Code Playgroud)
但是,当他们不知道文件中有多少行时,就不能这样做 - 我将在一批许多文件中使用它.我如何在vim和sed中执行此操作?
事实上,我确实看过这篇文章,但没有发现它有用.
这是我的代码:
for (c = 0; c < PROCESSES; c++) {
pid[c] = fork();
switch (pid[c]) {
case -1:
perror("Faild fork!\n");
break;
case 0:
printf("C = %d\n", c);
if (c == 0) {
printf("MY ID0 %d\n", getpid());
customers();
break;
}
if (c == 1) {
printf("MY ID1 %d\n", getpid());
cashier();
break;
}
if (c == 2) {
printf("MY ID2 %d\n", getpid());
sales();
break;
}
if (c == 3) {
printf("MY ID3 %d\n", getpid());
warehouse();
break;
}
break;
default:
if (c == …
Run Code Online (Sandbox Code Playgroud) 在以下代码中:
...
char *message = "This is the message!";
...
printf("Writing to file descriptor FD[%i] \n", fd[1]);
write( fd[1], message, strlen(message));
printf("Reading from file descriptor FD[%i] \n", fd[0]);
read( fd[0], buffer, strlen(message));
printf("Message from FD[%i] : \"%s\" .\n", fd[0], buffer);
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
"This is the message!???" .
Run Code Online (Sandbox Code Playgroud)
但如果我删除"!" 从我的消息,输出没有随机字符...任何想法为什么我会出现这3个随机字符?
我一直在寻找解决方案,有很多类似的问题,但没有任何正确的答案帮助我解决问题.
首先,我的问题/问题:
SELECT
查询吗?这是我的数据库的SQL转储,包含示例数据:http://pastie.org/private/vq7qkfer5mwyraudb5dh0a
这是我认为可以解决的问题:
SELECT firstname, lastname, sum(goal.goal), sum(assist.assist), sum(gw.gw), sum(win.win), count(played.idplayer) FROM player
LEFT JOIN goal USING (idplayer)
LEFT JOIN assist USING (idplayer)
LEFT JOIN gw USING (idplayer)
LEFT JOIN win USING (idplayer)
LEFT JOIN played USING (idplayer)
GROUP BY idplayer
Run Code Online (Sandbox Code Playgroud)
我想要生成的是一个表格,其中目标,辅助,gw,win和play的列是该列中每行的总和/计数,如下所示:(提供的样本数据)
+-----------+----------+------+--------+----+-----+--------+
| firstname | lastname | goal | assist | gw | win | played |
+-----------+----------+------+--------+----+-----+--------+
| Gandalf | The White| 10 | 6 | 1 | 1 | …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用JUnit 4.11来设置执行顺序.
我尝试在Ecipse IDE中运行此链接上的参数化测试示例(更改参数化测试的名称),我看到Eclipse IDE中显示的测试名称没有变化.我希望看到测试名称显示为test [1:fib(1)= 1]和test [4:fib(4)= 3],但它们显示为test [0]和test [1]
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
Run Code Online (Sandbox Code Playgroud)
在Eclipse IDE中运行的以下示例导致以下执行顺序(b,a,d,c)而不是预期的(a,b,c,d)
package com.org;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ExecutionOrderTestName {
@Test
public void bTest() {
System.out.println("b");
}
@Test
public void aTest() {
System.out.println("a");
}
@Test
public void dTest() {
System.out.println("d");
}
@Test
public void cTest() {
System.out.println("c");
}
}
Run Code Online (Sandbox Code Playgroud)
测试的顺序没有发生,我做错了什么?
我试图从另一个函数调用一个函数.我收到一个错误:
Fatal error: Call to undefined function getInitialInformation()
in controller.php on line 24
Run Code Online (Sandbox Code Playgroud)
controller.php文件:
require_once("model/model.php");
function intake() {
$info = getInitialInformation($id); //line 24
}
Run Code Online (Sandbox Code Playgroud)
模型/ model.php
function getInitialInformation($id) {
return $GLOBALS['em']->find('InitialInformation', $id);
}
Run Code Online (Sandbox Code Playgroud)
已尝试的事情:
我无法弄清楚这一点.我在这里错过了什么吗?
我想.html
使用Express 3 渲染原始页面,如下所示:
server.get('/', function(req, res) {
res.render('login.html');
}
Run Code Online (Sandbox Code Playgroud)
这就是我如何配置服务器来呈现原始HTML页面(灵感来自这个过时的问题):
server
.set('view options', {layout: false})
.set('views', './../')
.engine('html', function(str, options) {
return function(locals) {
return str;
};
});
Run Code Online (Sandbox Code Playgroud)
不幸的是,使用此配置页面会挂起并且永远不会正确呈现.我做错了什么?如何使用Express 3渲染原始HTLM而不使用Jade和EJS等花哨的渲染引擎?
众所周知,{}
定义像对象一样的对象的方法较短[]
.
但现在我想知道为什么:
{} != ({})
Run Code Online (Sandbox Code Playgroud)
{}
评估为undefined({})
评估"正确"对象为什么JavaScript表现得像这样?
例如1
等于(1)
,为什么{}
不等于({})
?
所以,我目前正在学习PHP并正在阅读一本关于密码的md5函数的书,所以我决定尝试一下,看看它是怎么回事.我还决定使用POST方法而不是GET,因为我看到人们说它更安全,并且不会让变量出现在URL上.
对于我的测试项目,我做了一个非常简单的表格,如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<form action="dologin" method="POST">
<table border="0">
<tbody>
<tr>
<td>Username:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password"></td>
</tr>
</tbody>
</table>
<input type="submit" value="Login">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
问题是当我在BOTH字段中输入值并单击"Login"时,我在另一个PHP文件上得到以下输出.
Notice: Undefined index: username in C:\xampp\htdocs\md5\home\dologin\index.php on line 11
Username non existent
Run Code Online (Sandbox Code Playgroud)
以下是"/dologin/index.php"文件的代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
mysql_connect("localhost", "root") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
$query = "SELECT password FROM users …
Run Code Online (Sandbox Code Playgroud)