问题列表 - 第43785页

如何从HSQLDB中的序列生成主键

目前我正在为我的项目使用HSQLDB 2.0.0.

我有一个主键和序列表.

我想在插入发生时从序列生成主键值.

触发可能吗?如果是这样,你能让我知道如何实现这一目标吗?

问候,

萨蒂亚

sql sequence hsqldb

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

有没有办法为Visual Studio设置默认浏览器以用于调试,这与我的系统默认浏览器不同?

有没有办法为Visual Studio设置默认浏览器以用于调试,这与我的系统默认浏览器不同?即时通讯使用Visual Studio 2010,我的系统默认浏览器是chrome但我希望VS使用firefox

browser visual-studio-2010

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

使用lisp进行机器人编程?

我正在寻找使用lisp的机器人/ AI编程的一些例子.是否有任何好的在线示例可用(最好不要过于学术性)?

lisp robotics artificial-intelligence robot

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

Rails浏览器检测方法

嘿大家,我想知道行业中哪些方法是Rails中的浏览器检测标准?是否有某个宝石,库或示例代码可以帮助确定浏览器并将类或ID应用于(X)HTML的body元素?谢谢,我只是想知道每个人使用什么以及是否有可接受的方法来做到这一点?

我知道我们可以获取user.agent并解析该字符串,但我不确定这是否是一种可接受的浏览器检测方式.

另外,我不打算在这里讨论功能检测,我已经在StackOverflow上阅读了多个答案,我要求的就是你们所做的.

[UPDATE]

所以感谢GitHub上的faunzy,我对Rails中的用户代理进行了一些了解,但是仍然不确定这是否是在Rails 3中进行此操作的最佳方式.但这就是我所得到的远:

def users_browser
user_agent =  request.env['HTTP_USER_AGENT'].downcase 
@users_browser ||= begin
  if user_agent.index('msie') && !user_agent.index('opera') && !user_agent.index('webtv')
                'ie'+user_agent[user_agent.index('msie')+5].chr
    elsif user_agent.index('gecko/')
        'gecko'
    elsif user_agent.index('opera')
        'opera'
    elsif user_agent.index('konqueror')
        'konqueror'
    elsif user_agent.index('ipod')
        'ipod'
    elsif user_agent.index('ipad')
        'ipad'
    elsif user_agent.index('iphone')
        'iphone'
    elsif user_agent.index('chrome/')
        'chrome'
    elsif user_agent.index('applewebkit/')
        'safari'
    elsif user_agent.index('googlebot/')
        'googlebot'
    elsif user_agent.index('msnbot')
        'msnbot'
    elsif user_agent.index('yahoo! slurp')
        'yahoobot'
    #Everything thinks it's mozilla, so this goes last
    elsif user_agent.index('mozilla/')
        'gecko'
    else
        'unknown'
    end
    end

    return @users_browser
end
Run Code Online (Sandbox Code Playgroud)

ruby user-agent ruby-on-rails browser-detection

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

升级后的pg_config,ruby pg,postgresql 9.0问题,centos 5

在postgresql 8.1升级到9.0之后,我发现了库依赖的问题.Postgresql工作正常(连接,查询).

yum list postgresql*
Installed Packages
postgresql.i386 9.0.0-1PGDG.el5 installed
postgresql-debuginfo.i386 9.0.0-1PGDG.el5 installed
postgresql-devel.i386 9.0.0-1PGDG.el5 installed
postgresql-libs.i386 9.0.0-1PGDG.el5 installed
postgresql-odbcng.i386 0.90.101-2.el5 installed
postgresql-plruby.i386 0.5.1-5.el5 installed
postgresql-server.i386 9.0.0-1PGDG.el5 install
Run Code Online (Sandbox Code Playgroud)

但当我试图为红宝石安装'pg'时,我收到了

gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for pg_config... no
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack …
Run Code Online (Sandbox Code Playgroud)

ruby postgresql gem centos5 pg

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

Rails 3:手动增加一个带有mongoid的字段

我开始在rails3中使用gem mongoid.

我想知道如何手动增加包含整数的字段.

我尝试了很多方法,但没有人运作良好.

我想知道这个动作是否可以在原子环境中完成?

mongoid ruby-on-rails-3

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

为什么要在单独的项目而不是文件夹中进行测试?

只是出于兴趣 - 为什么决定将测试移动到一个单独的项目,而不仅仅是单独的源文件夹?

android unit-testing

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

jquery最后关注的元素

我有一个基本的登录表单,它使用ajax登录用户.如果详细信息不正确,则会显示文本,显示登录失败.当显示最后一个文本框时,用户输入的文本将失去焦点.

在按提交/按下输入之前,是否可以将焦点设置到用户所在的最后一个文本框?

$('#login').click(function (e) 
 { 
  e.preventDefault();
  $.ajax({
  type: "POST",
  dataType: "text",
  url: "login.php",
  data: "username=" + $("#username").val() + "&password=" + $("#password").val(),
  cache: false,
  success: function(reply)
  {
   if (reply.indexOf("Success") >= 0)
   {
    location.reload();
   }
   else
   {
    $("#loginResult").html("Login Failed");
    //set focus here       
   }
  }
 }); 
Run Code Online (Sandbox Code Playgroud)

有任何建议,谢谢.

jquery setfocus

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

用于视网膜显示的CoreGraphics

我正在使用以下代码对我加载的图像执行一些操作,但我发现当它在视网膜显示器上时显示变得模糊

- (UIImage*)createImageSection:(UIImage*)image section:(CGRect)section

{
float originalWidth = image.size.width ;
float originalHeight = image.size.height ;
int w = originalWidth * section.size.width;
int h = originalHeight * section.size.height;

CGContextRef ctx = CGBitmapContextCreate(nil, w, h, 8, w * 8,CGImageGetColorSpace([image CGImage]), kCGImageAlphaPremultipliedLast);
CGContextClearRect(ctx, CGRectMake(0, 0, originalWidth * section.size.width, originalHeight * section.size.height)); // w + h before
CGContextTranslateCTM(ctx, (float)-originalWidth * section.origin.x, (float)-originalHeight * section.origin.y);
CGContextDrawImage(ctx, CGRectMake(0, 0, originalWidth, originalHeight), [image CGImage]);
CGImageRef cgImage = CGBitmapContextCreateImage(ctx);
UIImage* resultImage = [[UIImage alloc] initWithCGImage:cgImage];

CGContextRelease(ctx);
CGImageRelease(cgImage);

return …
Run Code Online (Sandbox Code Playgroud)

iphone cg core-graphics retina-display

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

在浏览器中渲染模板并更改网址字符串?

我有2个动作 - 编辑和更新."编辑"中的表单将值提交给"更新"操作.当保存模型失败时,我渲染编辑teplate,用户看到错误,并且字段预先填充了之前填充的内容.有一个巨大但对我来说 - 在用户浏览器中的URL面板中有/ user/update,即使(因为)我渲染了编辑模板.我可以通过在update操作中将一些参数传递给render方法来改变它吗?我不希望用户看到除了编辑之外还有任何(更新)操作.可能吗?

ruby-on-rails ruby-on-rails-3

9
推荐指数
2
解决办法
7909
查看次数