小编wad*_*rld的帖子

如何在使用Cocoa绑定时取消保存首选项?

我刚刚开始搞乱绑定.我已经开始实现一个首选项对话框,将一些NSColorWell绑定到共享默认控制器.那是完美的.我的值被编码并正确保存.

但是,什么不起作用是取消对话框.如果我取消,则仍会保存这些值.

似乎我应该将取消按钮绑定到NSUserDefaultController的"恢复",但当然如果我这样做,我不能将它绑定到"performClose"(除非有一种方法将按钮绑定到多个动作,我我不知道.

我应该如何绑定取消按钮以恢复更改并关闭窗口.显然,我可以通过编写一个同时执行这两种操作的方法来实现,但似乎应该可以在IB中实现.

macos cocoa cocoa-bindings

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

Spring Injected Bean属性为null

我对注射豆子的想法很新,所以慢慢说.:)

我有一个注入bean的类,但是当访问该属性时,该属性为null,我得到一个空指针异常.

来自/project-TRUNK/war-module/src/main/webapp/WEB-INF/spring-config/spring-bean.xml

 <bean id="linkCheck"
  class="com.dogwatch.util.LinkCheck">
  <property name="linkDao" ref="jdbcLinkDao" />
 </bean>
Run Code Online (Sandbox Code Playgroud)

来自/project-TRUNK/war-module/src/main/webapp/WEB-INF/spring-config/spring-dao.xml

 <bean id="jdbcLinkDao" class="com.dogwatch.util.jdbcLinkDao">
  <property name="dataSource" ref="dataSource" />
  <property name="linkJdbcDataTypesSupport" ref="linkJdbcDataTypesSupport"/>
 </bean>
Run Code Online (Sandbox Code Playgroud)

众所周知,DAO bean很好,可以在其他几个类中使用.

package com.dogwatch.util;
public class LinkCheck {

 private LinkDAO linkDao;


 public LinkDAO getLinkDao() {
  return linkDao;
 }

 public void setLinkDao(LinkDAO linkDao) {
  this. linkDao = linkDao;
 }
}
Run Code Online (Sandbox Code Playgroud)

我一直在将它与使用相同DAO bean的其他类进行比较,但我找不到任何差异.

我确实看到了bean的定义:

INFO [2010-01-15 01:10:05,838] [main] [XmlBeanDefinitionReader] [XmlBeanDefinitionReader.java:323] - 从URL加载XML bean定义[file:war-module/src/main/webapp/WEB-INF/spring-config/spring-dao.xml] INFO [2010-01-15 01:10:05,858] [main] [XmlBeanDefinitionReader] [XmlBeanDefinitionReader.java:323] - 从URL加载XML bean定义[file:war-module/src/main/webapp/WEB-INF/spring-config/spring-bean.xml] INFO [2010-01-15 01:10:06,597] [main] [DefaultListableBeanFactory] ​​[DefaultListableBeanFactory.java:414] - …

java spring

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

Postgres在授予角色权限后无法创建数据库

我确定我错过了一些简单的东西,但我创造了以下内容:

postgres=# \du
                          List of roles
 Role name |               Attributes                | Member of
-----------+-----------------------------------------+-----------
 admin     | No inheritance, Create DB, Cannot login | {}
 postgres  | Superuser, Create role, Create DB       | {}
 wade      |                                         | {admin}
Run Code Online (Sandbox Code Playgroud)

(请注意,Cannot login并且No inheritance不会影响正在发生的事情wade.请参阅PostgreSQL文档了解角色成员资格以了解原因.-bignose)

但是,当我尝试创建数据库时,我得到:

bin wwilliam$ createdb -U wade test
Password:
createdb: database creation failed: ERROR:  permission denied to create database
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

postgresql grant

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

没有xml bean定义的Spring组件检测

@Component只要配置了上下文组件扫描,只使用注释就能创建spring bean是否正确?

使用带有Java 6的spring 3.0.5.

我的测试用例是:

@ContextConfiguration(locations={"classpath:spring-bean.xml"})

public class ServerServiceUnitTest extends AbstractJUnit4SpringContextTests {
    @Autowired
    private ServerService serverService;

    @Test
    public void test_server_service() throws Exception {
           serverService.doSomething();
           //additional test code here
        }
}
Run Code Online (Sandbox Code Playgroud)

spring-bean.xml文件包含:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <context:annotation-config/>
</beans>
Run Code Online (Sandbox Code Playgroud)

我想成为一个bean的课程是:

@Component("ServerService")
public class ServerServiceImpl implements ServerService {
    private static final String SERVER_NAME = "test.nowhere.com";
        //method definitions.....'
}
Run Code Online (Sandbox Code Playgroud)

那不足以让spring实例化ServerServicebean并进行自动装配吗?

我得到的错误是:

由以下原因引起:org.springframework.beans.factory.NoSuchBeanDefinitionException:没有为依赖项找到类型[serversystem.ServerService]的匹配bean:期望至少有1个bean符合此依赖项的autowire候选者.依赖注释:{@ org.springframework.beans.factory.annotation.Autowired(required = true)}

我确定我错过了一些简单的事情.

spring annotations javabeans

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

直接在user_constraint表中重命名Oracle约束的任何问题?

使用Oracle 10g,我需要重命名一堆FK约束,这些约束都以LITE结尾以包含FK前缀.

我的想法是(我确保所有名称都足够短以容纳前缀):

DECLARE
  v_name VARCHAR2(30 BYTE);
  v_new_name VARCHAR2(30 BYTE);
  CURSOR c1 is select CONSTRAINT name from user_constraints where constraint_type = 'R' and constraint_name like '%_LITE';
BEGIN
   OPEN c1;
   LOOP
      FETCH c1 into v_name;
      EXIT when c1%NOTFOUND;
      v_new_name:= 'FK_' || v_name;
      update user_constraints SET constraint_name = v_new_name where constraint_name = v_name;
   END LOOP;
   close c1;
END;
Run Code Online (Sandbox Code Playgroud)

任何原因导致不安全,我应该创建alter table语句?

oracle plsql oracle10g

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

将%rowtype与连接和重复列一起使用

给定(忽略缺少主键,外键等 - 这不是表设计,只是一个例子):

Order:
----------
ID NUMBER;
VENDOR NUMBER;
PART NUMBER;

Parts:
------------
ID NUMBER;
VENDOR NUMBER;
DESCRIPTION VARCHAR2(1000 CHAR);


cursor c1 is select * from order o left join parts p on o.part = p.id;
c_row c1%rowtype;
Run Code Online (Sandbox Code Playgroud)

如何区分将在联接中的两个VENDOR列?

我不认为我可以做c_row.value,因为那会是模棱两可的,我不认为像c_row.p.vendor这样的东西有效.

如何引用两个值列的特定实例?

oracle plsql join oracle10g

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

Perl elsif没有被评估

有人看到这个代码有什么问题吗?当我们执行它(在Linux上)时,我们直接进入"错误:未知主机"块.

Perl是5.8.6版

$hostname = "host2";

if ($hostname eq "host1") {
  $dbhost = 'dbi:Oracle:dbhost1';
}
elsif ($hostname eq "host2") {
  $dbhost = 'dbi:Oracle:dbhost2';
}
elsif ($hostname eq "host3" || $hostname eq "host4") {
  $dbhost = 'dbi:Oracle:dbhost3';
}
else {
  print "ERROR: UNKNOWN HOST\n";
  die "Can't connect";
}
Run Code Online (Sandbox Code Playgroud)

string perl flow-control

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

带有gcc和pthreads的未定义引用错误_dl_stack_flags

尝试在Ubuntu上使用pthreads编译应用程序时出现以下错误:

/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libpthread.a(pthread_create.o): In function `allocate_stack':
/build/buildd/eglibc-2.11.1/nptl/allocatestack.c:444: undefined reference to `_dl_stack_flags'
Run Code Online (Sandbox Code Playgroud)

Ubuntu版本是:

wade@wadesworld:~$ uname -a
Linux wadesworld 2.6.18-194.8.1.el5.028stab070.5ent #1 SMP Fri Sep 17 19:46:02 MSD 2010 i686 GNU/Linux
Run Code Online (Sandbox Code Playgroud)

gcc版本是:

wade@wadesworld:~$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
Run Code Online (Sandbox Code Playgroud)

构建命令是:

/usr/bin/cmake -E cmake_link_script CMakeFiles/vtest.dir/link.txt …
Run Code Online (Sandbox Code Playgroud)

ubuntu gcc pthreads

0
推荐指数
1
解决办法
4403
查看次数

将行作为列返回

我喜欢将它作为单个查询来做,但我认为它需要一个游标.如果我不能将它作为单个查询执行,我想将结果输出为SYS_REFCURSOR.一个简化的例子:

产品

ID   NAME         Part Number   SKU
------------------------------------
1    Widgetizer     150         1001
2    Widgetizer200  200         1002
3    WidgetizerDlx  250         1003
Run Code Online (Sandbox Code Playgroud)

PRODUCT_SPEC

P_ID   NAME     VALUE
----------------------------
1      WEIGHT    5
1      HEIGHT    10
1      VERSION   1
1      COLOR     RED
2      WEIGHT    7
2      HEIGHT    10
2      VERSION   2
2      COLOR     BLUE
Run Code Online (Sandbox Code Playgroud)

查询:

对于SKU小于1003的每种产品,请返回:

Product name, part #, SKU, WEIGHT, HEIGHT, COLOR
Run Code Online (Sandbox Code Playgroud)

sql oracle pivot oracle10g

0
推荐指数
1
解决办法
386
查看次数