小编sko*_*ine的帖子

为什么Twitter Bootstrap表总是有100%的宽度?

假设这个标记:

<table class="table table-bordered" align="center"> 
Run Code Online (Sandbox Code Playgroud)

没有我有多少单元格,表格总是100%宽度.为什么?

twitter-bootstrap

141
推荐指数
5
解决办法
14万
查看次数

PostgreSQL'NOT IN'和子查询

我正在尝试执行此查询:

SELECT mac, creation_date 
FROM logs 
WHERE logs_type_id=11
AND mac NOT IN (select consols.mac from consols)
Run Code Online (Sandbox Code Playgroud)

但我没有结果.我测试了它,我知道语法有问题.在MySQL中,这样的查询非常有效.我添加了一行以确保表mac中不存在一行consols,但仍然没有给出任何结果.

postgresql subquery

82
推荐指数
3
解决办法
13万
查看次数

git列出所有可用的命令

是否有命令可以显示GIT中所有可用命令的列表?有git help,但它显示:

usage: git [--version] [--exec-path[=<path>]] [--html-path]
           [-p|--paginate|--no-pager] [--no-replace-objects]
           [--bare] [--git-dir=<path>] [--work-tree=<path>]
           [-c name=value] [--help]
           <command> [<args>]

The most commonly used git commands are:
   add        Add file contents to the index
   bisect     Find by binary search the change that introduced a bug
   branch     List, create, or delete branches
   checkout   Checkout a branch or paths to the working tree
   clone      Clone a repository into a new directory
   commit     Record changes to the repository
   diff       Show changes between commits, commit …
Run Code Online (Sandbox Code Playgroud)

git ubuntu

48
推荐指数
2
解决办法
2万
查看次数

Twitter bootstrap混合水平形式与内联

嗨我试图使内联形式混合水平我有http://jsfiddle.net/TNLnP/3/但我想得到类似的东西

<label><input>
<label><input><label><input><label><input>
Run Code Online (Sandbox Code Playgroud)

forms twitter-bootstrap

21
推荐指数
1
解决办法
2万
查看次数

spring mvc在哪里放css/js/img文件

0并且有问题在哪里放置我试过的公共文件在spring-mvc应用程序中放置图像/ CSS的位置?这个解决方案,但它不适合我

我试图将我的公共文件夹放在WEB-INF目录外的所有位置,但仍然没有

web.xml中

    <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

  <display-name>s-mvc</display-name>
  <servlet>
    <servlet-name>frontController</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>frontController</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

  <mvc:resources mapping="/css/**" location="/css/"/>

</web-app>
Run Code Online (Sandbox Code Playgroud)

frontcontroller-servlet.xml中

<mvc:annotation-driven/>

    <context:component-scan base-package="pl.skowronline.controller" />

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/views/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
Run Code Online (Sandbox Code Playgroud)

以及我如何调用css文件 <link type="text/css" href="/css/bootstrap.css" rel="stylesheet" />

css spring-mvc

13
推荐指数
3
解决办法
4万
查看次数

在Java中使用unsigned转换smallint

我正在使用jOOQ来获取MySQL中的id smallint unsigned primary key auto_increment

public List<Integer> getID() {
   Factory sql = new Factory(Database.getInstance().connect(), SQLDialect.MYSQL);
   return (List<Integer>) sql.select().from("users").fetch().getValues("id_users");
}
Run Code Online (Sandbox Code Playgroud)

然后出错

org.jooq.tools.unsigned.UShort cannot be cast to java.lang.Integer
Run Code Online (Sandbox Code Playgroud)

在这里,他们写道,smallint unsigned应该转换为int.

编辑 方法应该是

public List<UShort> getID() {
    Factory sql = new Factory(Database.getInstance().connect(), SQLDialect.MYSQL);
    return (List<UShort>) sql.select().from("users").fetch().getValues("id_users");
}
Run Code Online (Sandbox Code Playgroud)

并且循环结果应该转换为int.

java mysql casting jooq

5
推荐指数
1
解决办法
1445
查看次数

symfony2"Doctrine\ORM\EntityRepository"的类子类不是有效实体或映射超类

namespace griffin\UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
/**
 * @ORM\Entity(repositoryClass="griffin\UserBundle\Entity\UserRepository")
 * @ORM\Table(name="users")
 */
class User {

    const STATUS_ACTIVE   = 1;
    const STATUS_INACTIVE = 0;

    /**
     * @ORM\Id
     * @ORM\Column(name="id_users", type="smallint")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $idUsers;
Run Code Online (Sandbox Code Playgroud)

和Repository类一样

namespace griffin\UserBundle\Entity;
use Doctrine\ORM\EntityRepository;

class UserRepository extends EntityRepository {

    public function getAdmin()
    {
        return $this->getEntityManager()
                ->createQuery('select * from users where users_groups_id = 1')
                ->getResults;
    }
}
Run Code Online (Sandbox Code Playgroud)

当我在控制器中调用它时

$results = $this->getDoctrine()
    ->getRepository('griffin\UserBundle\Entity\UserRepository')
    ->getAdmin();

var_dump($results);
Run Code Online (Sandbox Code Playgroud)

我收到了错误 Class "griffin\UserBundle\Entity\UserRepository" sub class of "Doctrine\ORM\EntityRepository" is not a valid entity …

doctrine symfony

5
推荐指数
1
解决办法
6002
查看次数

Symfony2:Doctrine 订阅者抛出 ContextErrorException - 必须是 Doctrine\Common\Persistence\Event\PreUpdateEventArgs 的实例

我有这样的听众

use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Doctrine\Common\Persistence\Event\PreUpdateEventArgs;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Events;

class MachineSubscriber implements EventSubscriber
Run Code Online (Sandbox Code Playgroud)

和方法

/**
     * @param PreUpdateEventArgs $args
     */
    public function preUpdate(PreUpdateEventArgs $args)
Run Code Online (Sandbox Code Playgroud)

和教义抛出异常

ContextErrorException:可捕获的致命错误:传递给 Certificate\MachineBundle\Event\MachineSubscriber::preUpdate() 的参数 1 必须是 Doctrine\Common\Persistence\Event\PreUpdateEventArgs 的实例,给定的 Doctrine\ORM\Event\PreUpdateEventArgs 实例,

这很奇怪,因为我使用了正确的课程。

doctrine symfony doctrine-orm

4
推荐指数
1
解决办法
2555
查看次数

从bash执行php脚本时出错

嗨我试图从bash脚本执行php文件

#!/bin/sh

php ./func.php
Run Code Online (Sandbox Code Playgroud)

func.php文件看起来像

<?php

echo "php file";
Run Code Online (Sandbox Code Playgroud)

并作为输出 PHP Warning: Module 'apc' already loaded in Unknown on line 0

编辑:也许你也可以告诉我如何将参数传递给php文件?

php bash

3
推荐指数
1
解决办法
1982
查看次数

如何在symfony2中测试路由

在Kohana您可以测试这样的路线

$route = Route::get('admin');
echo Kohana_Debug::dump($route->matches('admin/user/edit/10'));
Run Code Online (Sandbox Code Playgroud)

以及如何在symfony2中测试路由.

routing symfony

3
推荐指数
1
解决办法
2606
查看次数