小编blu*_*din的帖子

使用Postgres.app无法在Mavericks中安装pg gem

我正在尝试安装pg gem以便在我的本地机器上使用Postgres.app.我正在经营小牛队.

Postgres.app安装并运行正常,但我无法让宝石工作.我做了以下事情:

  1. 使用Postgres.app文档中的命令'env ARCHFLAGS =" - arch x86_64"gem install pg - --with-pg-config =/Applications/Postgres.app/Contents/MacOS/bin/pg_config'
  2. 更新了Homebrew并安装了Apple GCC 4.2
  3. 安装了Xcode开发人员工具
  4. 更新了我的$ PATH以引用Postgres.app bin和lib目录

一切都没有成功.这是我收到的具体错误消息:

Building native extensions with: '--with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config'
This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /Users/Brian/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/MacOS/bin/pg_config
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not …
Run Code Online (Sandbox Code Playgroud)

postgresql macos ruby-on-rails pg osx-mavericks

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

res.body在这个使用supertest和Node.js的测试中是空的

我正在使用supertest测试Node.js API ,我无法解释为什么res.body对象超集返回为空.数据显示在res.text对象中,但不是res.body,任何想法如何解决这个问题?

我正在使用Express和body-parser:

app.use(bodyParser.json());
app.use(bodyParser.json({ type: jsonMimeType }));
app.use(bodyParser.urlencoded({ extended: true }));
Run Code Online (Sandbox Code Playgroud)

这是我正在测试的API方法:

app.get(apiPath + '/menu', function(req, res) {
  var expiration = getExpiration();

  res.set({
    'Content-Type': jsonMimeType,
    'Content-Length': jsonTestData.length,
    'Last-Modified': new Date(),
    'Expires': expiration,
    'ETag': null
  });

  res.json({ items: jsonTestData });
}
Run Code Online (Sandbox Code Playgroud)

以下是我针对此API方法执行的测试:

describe('GET /menu', function() {
  describe('HTTP headers', function() {
    it('responds with the right MIME type', function(done) {
      request(app)
        .get(apiPath + '/menu')
        .set('Accept', 'application/vnd.burgers.api+json')
        .expect('Content-Type', 'application/vnd.burgers.api+json; charset=utf-8')
        .expect(200, done); …
Run Code Online (Sandbox Code Playgroud)

mocha.js node.js supertest

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

手动模态segue不起作用,View Controller不在窗口层次结构中?

我一直在网上搜索Stack Overflow几个小时,我无法解决这个问题.这里希望你们都看到我的错误,因为我找不到它.

我刚开始有一个简单的基于故事板的应用程序.最初的ViewController是UITabBarController的一个实例,它带有来自模板的两个虚拟ViewControllers.启动时,我需要检查设备是否已登录到外部服务.如果没有,我将显示一个允许用户进行身份验证的模态ViewController,如果设备已经过身份验证,那么我将只显示FirstViewController.

以下步骤是自创建项目以来我所做的一切:

  1. 在Storyboard上创建AuthenticateViewController场景
  2. 为AuthenticateViewController创建代码文件,并将它们分配给相应的场景
  3. 为UITabBarController子类创建代码文件,并将初始UITabBarController场景与该新子类关联
  4. 在故事板上从UITabBarController场景到AuthenticateViewController场景创建一个新的segue
  5. viewDidLoadUITabBarController子类中手动调用segue

当我运行应用程序时,模态segue不会触发,显示UITabBarController的第一个ViewController,我在XCode中得到以下输出:

Warning: Attempt to present <AuthenticateViewController: 0x83c0c10> on <EPTabBarController: 0x83be600> whose view is not in the window hierarchy!
Run Code Online (Sandbox Code Playgroud)

下面的相关代码,实际上是我到目前为止添加的唯一代码.如果截图或其他信息有用,请告诉我.在此先感谢您的帮助.

EPTabBarController,UITabBarController的子类:

#import "EPTabBarController.h"
#import "AuthenticateViewController.h"

@interface EPTabBarController ()

@end

@implementation EPTabBarController

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self performSegueWithIdentifier:@"authenticationSegue" sender:self];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
Run Code Online (Sandbox Code Playgroud)

ios ios5 uistoryboard uistoryboardsegue ios6

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

如何检查查询字符串是否具有Express.js/Node.js中的值?

如何检查传递给Express.js应用程序的查询字符串是否包含任何值?如果我有一个API URL,可以是:http://example.com/api/objects或者http://example.com/api/objects?name=itemName,条件语句用于确定我正在处理的是什么?

我当前的代码在下面,它总是评估为'should have no string'选项.

if (req.query !== {}) {
    console.log('should have no query string');
}
else {
    console.log('should have query string');
}
Run Code Online (Sandbox Code Playgroud)

javascript node.js express

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

我的UITableView顶部不需要的空白UITableViewCell

我有一个UITableView,它顶部有一个空白行,我无法弄清楚原因.这是相关的代码,你们有谁知道这里发生了什么?

UITableView加载时没有内容.此方法是在以下情况下启动每个数据刷新的方法:

- (IBAction)updateButton:(id)sender 
{
    if (questionsTextField.isFirstResponder) {
        [questionsTextField resignFirstResponder];
        [self assignQuestionsCount];
    }

    if (currentNumberOfQuestions > 0) {
        // do work calculating
        currentTest = nil;

        currentTest = [self retrieveCurrentTest];
        currentTest.numberOfQuestions = currentNumberOfQuestions;
        currentTest.decimalPlacesToDisplay = 0;
        currentTest.roundingBreakPoint = 0.5;

        currentGradeScale = nil;
        currentGradeScale = [currentTest generateGradingScale];
        [scoresTableView reloadData];
    }
    else {
        // my error handling on text boxes here....
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我对UITableView方法的实现:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.currentGradeScale count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentifier …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios

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

为什么我在这个 SASS 文件中得到一个未定义的 Foundation 变量错误?

我有一个 Rails 4 应用程序,使用 Foundation-rails v5.2.1.0 gem 和一个用于我的应用程序布局的自定义 SCSS 文件。当我使用foundation_and_overrides.scss文件中的变量时,出现以下错误:

Undefined variable: "$header-font-family"
Run Code Online (Sandbox Code Playgroud)

我在下面包含了相关代码。如果需要,我可以发布更多。有谁知道这里发生了什么?

来自application.css

*
 *= require foundation_and_overrides
 *= require_self
 *= require_tree .
 */
Run Code Online (Sandbox Code Playgroud)

来自foundation_and_overrides.scss

// We use these to control header font styles
$header-font-family: "futura-pt", sans-serif;
$header-font-weight: 400;
// $header-font-style: normal;
Run Code Online (Sandbox Code Playgroud)

来自custom.css.scss

$include-html-global-classes: false;
@import "foundation/components/global";
. 
. 
. 
.footer {
  background-color: black;
  color: white;
  height: 100px;
  font-family: $header-font-family;
}
Run Code Online (Sandbox Code Playgroud)

css ruby-on-rails sass zurb-foundation

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