小编Ymo*_* Wu的帖子

Node.js为heroku构建json api

我想通过node.js构建API,它在本地正常工作,但在云中失败.你能帮我找到这个bug吗?谢谢

https://infinite-gorge-6020.herokuapp.com

app.get('/', function(req, res) {
  res.render('index.ejs');
});

app.get('/host', function(req, res) {
  var sessionId = app.get('sessionId'),
      // generate a fresh token for this client
      token = opentok.generateToken(sessionId, { role: 'moderator' });

  res.json('host.ejs', {
    apiKey: apiKey,
    sessionId: sessionId,
    token: token
  });
Run Code Online (Sandbox Code Playgroud)

日志

2014-11-26T03:25:38.289313+00:00 heroku[router]: at=info method=GET path="/css/sample.css" host=infinite-gorge-6020.herokuapp.com request_id=18d8ce80-53a3-487f-94f5-a45f984bad67 fwd="1.171.57.36" dyno=web.1 connect=4ms service=6ms status=200 bytes=720
2014-11-26T03:25:39.207199+00:00 heroku[router]: http_error="Invalid HTTP status line" at=error code=H17 desc="Poorly formatted HTTP response" method=GET path="/host" host=infinite-gorge-6020.herokuapp.com request_id=a56aaf2e-7d2b-4479-bc01-3efd9542432b fwd="1.171.57.36" dyno=web.1 connect=1ms service=3ms status=503 bytes=639
2014-11-26T03:30:50+00:00 heroku[slug-compiler]: Slug compilation …
Run Code Online (Sandbox Code Playgroud)

javascript json heroku node.js express

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

如何控制 daisyUI tailwind 模式默认打开

我设置了 daisyUI 但不知道如何按条件控制模态

我认为与 flowbite 或 bootstrap 类似 https://flowbite.com/docs/components/modal/

但是daisyUI还没有实现隐藏类,并且有

库中的模态开放方法

https://daisyui.com/components/modal/

<link href="https://cdn.jsdelivr.net/npm/daisyui@2.13.6/dist/full.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.tailwindcss.com"></script>

<!-- The button to open modal -->
<label for="my-modal-4" class="btn modal-button">open modal</label>

<!-- Put this part before </body> tag -->
<input type="checkbox" id="my-modal-4" class="modal-toggle">
<label for="my-modal-4" class="modal cursor-pointer">
  <label class="modal-box relative" for="">
    <h3 class="text-lg font-bold">Congratulations random Interner user!</h3>
    <p class="py-4">You've been selected for a chance to get one year of subscription to use Wikipedia for free!</p>
  </label>
</label>
Run Code Online (Sandbox Code Playgroud)

那么我们如何配置当前可见的模态视图呢?

多谢

javascript ruby-on-rails modal-dialog tailwind-css daisyui

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

如何从Main(ActionBarActivity)intent Activity获取ActionBar

我使用ActionBarActivity意图一个新的Activity但我不能在Activity中调用ActionBar方法

//        requestWindowFeature(Window.FEATURE_ACTION_BAR);
//        getActionBar().setTitle("123");
        ActionBar actionBar =getActionBar();
//
        actionBar.setDisplayHomeAsUpEnabled(true);
Run Code Online (Sandbox Code Playgroud)

将得到null

01-14 16:29:58.712    3405-3405/com.fragment.test E/AndroidRuntime? FATAL EXCEPTION: main
    Process: com.fragment.test, PID: 3405
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fragment.test/com.fragment.test.Ac1}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
            at …
Run Code Online (Sandbox Code Playgroud)

android android-intent android-actionbar android-actionbaractivity

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