正如我在标题中所说,我已经安装了PostgreSQL usind MacPorts,但无法访问它.
安装过程是
$ sudo port install postgresql83-server
$ sudo mkdir -p /opt/local/var/db/postgresql83/webcraft
$ sudo chown postgres:postgres /opt/local/var/db/postgresql83/webcraft
$ sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/webcraft'
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist
Run Code Online (Sandbox Code Playgroud)
我的路径是
/opt/local/lib/postgresql83/bin:/opt/local/lib/mysql5/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
Run Code Online (Sandbox Code Playgroud)
我尝试使用psql客户端连接服务器
$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)
这是一些信息
$ ps ax | grep postgres | grep -v grep
52 ?? Ss 0:00.00 /opt/local/bin/daemondo --label=postgresql83-server --start-cmd …Run Code Online (Sandbox Code Playgroud) 必须有一个简单的解决方案,我正在尝试在我的DateTime属性上使用NHibernate Validator属性.如果值为null(via [NotNull]),我希望它验证失败.当我提交一个空值时,它会被转换为,1/1/0001 12:00:00 AM而NHibernate不会将其选为null.我想我可以编写一个自定义验证规则,如果提交该日期则返回false,但是肯定有一个标准的方法吗?
澄清:这是一个示例类,
public class ExampleClass {
[NotNull]
public virtual DateTime MySpecialDateProperty { get; set; }
[NotNullOrEmpty]
public virtual string MyString { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我有NHibernate Validator设置,所以在我的控制器中,我可以这样做:
newExampleClass.IsValid() 如果它是真的它会在数据库中存在,如果不是,我会返回 newExampleClass.ValidationResults()
当我创建一个新实例时ExampleClass,MySpecialDateProperty初始化为1/1/0001 ...并且验证器不会将其作为空值选择.
编辑2:我应该设置DateTime为nullable(DateTime?),这会阻止NHibernate将值设置为最小DateTime吗?
如何检测USB驱动器何时连接到Windows,Linux或Mac中的计算机?
我在网上看到的唯一方法是迭代驱动器,但我认为没有一种非常好的方法来实现跨平台(例如Linux中的File.listRoots()只返回"/").即使在Windows中,这也会导致从每个设备读取问题,例如需要很长时间才能访问的网络驱动器.
有一个名为jUsb的库听起来像在Linux中完成了这个,但它在Windows中不起作用.还有一个名为jUsb for Windows的扩展名,但这要求用户安装dll文件并运行.reg.这些似乎都没有发展好几年,所以我希望现在有更好的解决方案.当我只想检测设备是否连接包含我需要的文件时,它们对于我需要的东西也是过度的.
[编辑]此外,jUsb显然不适用于任何最新版本的Java,所以这甚至不是一个选项......
谢谢
我想在$ text中替换以"[id"开头,中间部分未知并以"]结尾"的字符串.我知道如何替换以"[id"开头并以"]结束"的字符串,但我无法弄清楚如何将未知的中间身体部分作为替换规则.
任何想法如何替换像这样?
谢谢.
我在C++中有以下代码片段:
for (int x = -4; x < 5; ++x)
printf("hex x %d 0x%08X\n", x, x);
Run Code Online (Sandbox Code Playgroud)
它的输出是
hex x -4 0xFFFFFFFC
hex x -3 0xFFFFFFFD
hex x -2 0xFFFFFFFE
hex x -1 0xFFFFFFFF
hex x 0 0x00000000
hex x 1 0x00000001
hex x 2 0x00000002
hex x 3 0x00000003
hex x 4 0x00000004
Run Code Online (Sandbox Code Playgroud)
如果我在python中尝试相同的事情:
for x in range(-4,5):
print "hex x", x, hex(x)
Run Code Online (Sandbox Code Playgroud)
我得到以下内容
hex x -4 -0x4
hex x -3 -0x3
hex x -2 -0x2
hex x -1 -0x1 …Run Code Online (Sandbox Code Playgroud) 我有文件jar:
myJar/res/endingRule.txt
myJar/wordcalculator/merger/Marge.class
Run Code Online (Sandbox Code Playgroud)
在Marge.java我有代码:
private static final String ENDINGS_FILE_NAME = "res/endingRule.txt";
....
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(ENDINGS_FILE_NAME);
.....
但是在这个inputStream为null之后.如何使用资源?为什么空? 驱动一个普通的应用程序变量的UI是很困难的,但是当应用程序没有在您的开发平台上运行时,它就更难了.
那么哪些工具可以帮助我测试Windows Phone 7应用程序的UI?
我一直在尝试开发一个CALayer基于"CardView"的对象,它有两个彼此背对的层,以呈现卡片的两面.我一直在处理类似doublesided属性的事情,CALayer并发现结果令人困惑.我的基类是CALayer,我正在添加两个sublayers,一个带有M_PI/2变换,并且两者都有,doublesided = NO但就目前而言,无论我如何旋转卡而后面都没有显示,我得到正面显示.如果我不创建前面,后面显示两侧,文本在一个角落,而不是48点和模糊.
这是一个屏幕截图的链接,显示卡片刚刚在UIViewController's视图中完成一次完整的旋转.你看到前面的后面.这应该是看不见的,背面应该显示......我想......
https://files.me.com/gazelips/lj2aqo
// CardView.h
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
#define kCardWidth 100.0f
#define kCardHeight 150.0f
@interface CardView : CALayer {
CALayer *cardFront, *cardBack;
}
@property (nonatomic, retain) CALayer *cardFront, *cardBack;
- (id)initWithPosition:(CGPoint)point;
- (void)addPerspective;
- (CALayer *)createFront;
- (CALayer *)createBack;
@end
Run Code Online (Sandbox Code Playgroud)
// CardView.m
#import "CardView.h"
@implementation CardView
@synthesize cardFront, cardBack;
static CATransform3D kPerspectiveTransform;
- (id)initWithPosition:(CGPoint)point {
NSLog(@"--initWithPosition:CardView");
self = [super init];
if (self != …Run Code Online (Sandbox Code Playgroud) 我有一个模型Employee,它属于一个地址模型。当我从员工模型中获取数据时,关联的地址记录也将被获取。此外,地址模型具有virtualField full_name。看起来像这样:
Array
(
[0] => Array
(
[Employee] => Array
(
[id] => 1
[address_id] => 33
[username] => ...
...
)
[Address] => Array
(
[id] => 33
[firstname] => Blah
[full_name] => Blah Blubb
...
)
)
[1] => Array (
[Employee] => Array (
[id] => 2
...
Run Code Online (Sandbox Code Playgroud)
我也想将此virtualField包含在数据数组的Employee部分中,例如
Array (
[0] => Array (
[Employee] => Array
(
[id] => 1
[full_name] => Blah Blubb
...
)
Run Code Online (Sandbox Code Playgroud)
Tis不可能通过添加来解决
$virtualFields = array(
'full_name' => 'CONCAT_WS(" ", …Run Code Online (Sandbox Code Playgroud) 我有这个代码:
var proxy = XmlRpcProxyGen.Create<IMessageRpc>();
var proxy2 = XmlRpcProxyGen.Create<ITestRpc>();
Run Code Online (Sandbox Code Playgroud)
创建原型是 XmlRpcProxyGen.Create<T>
我想使用这样的函数:
public object GetProxy(XXX)
{
return mlRpcProxyGen.Create<XXX>();
}
Run Code Online (Sandbox Code Playgroud) java ×2
php ×2
c# ×1
cakephp ×1
cakephp-1.3 ×1
calayer ×1
installation ×1
ios ×1
jar ×1
macports ×1
nhibernate ×1
objective-c ×1
postgresql ×1
python ×1
regex ×1
replace ×1
resources ×1
string ×1
testing ×1