小编sab*_*bir的帖子

Read Network folder in node.js

I want to read network folder of my users. Users network folder information is stored in database. For example, \\\\192.168.3.107\\Network is one of my user network folder. As a user, I have made one of my folder Network as Network folder and my IP is 192.168.3.107. Now I want to read all of file inside that network file. I already done this in windows. But I need to implement this on Ubuntu. My code is given below:

 const fs …
Run Code Online (Sandbox Code Playgroud)

networking node.js

7
推荐指数
0
解决办法
1440
查看次数

多维数组中的字符串初始化

如何在多维数组中分配字符串值,将数组作为函数参数发送,并将其返回给main函数?我试过这个,但它给出了一个错误:

char a[250][250][250];   // does not work
a[][0][2] = "0";         // does not work
a[][1][2] = "0";         // does not work

char a[][2][2] = {"0", "1"};  // works

// error: expected primary-expression before ']' token
a[i][j][max] = add_func(a[i][j][], i, j); 
Run Code Online (Sandbox Code Playgroud)

c multidimensional-array

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

使用md5()的CodeIgniter登录系统

我是CodeIgniter的新手并使用CodeIgniter_2.1.3.我正在关注NETTUTS CodeIgniter教程.我想开发一个带有codeIgniter的登录系统,它在没有md5()函数的情况下运行良好[ 没有加密密码 ].然后我使用md5()函数创建带有加密密码的新表.然后登录代码不起作用.我的代码是::

视图/ login_form.php

<?php   
      // form design       

     echo form_open("login/validate") . "<br/>";    
     echo form_input("username", "Username") . "<br/> <br/>";
     echo form_password("password", "password") . "<br/> <br/>";
     echo form_submit("submit", "Login") . "<Br/> <Br/>";

     echo anchor("login/sign_up", "Create Account"); 

 ?>
Run Code Online (Sandbox Code Playgroud)

控制器/ login.php中

 <?php
     class Login extends CI_Controller {

        function index() {   // function of loading login page
           $data['main_content'] = "login_form";   // name of login page

           $this->load->view("includes/templet", $data);  
        }

    function validate() { …
Run Code Online (Sandbox Code Playgroud)

codeigniter

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

TypeError:Object#<MongoClient>没有方法'db'

我是node.js,mongodb,express的新手,在设置数据库方面遇到了很多麻烦.我的代码(app.js)如下

var express = require('express'),
    app = express(),
    cons = require('consolidate'),
    MongoClient = require('mongodb').MongoClient,
    Server = require('mongodb').Server;

    app.engine('html', cons.swig);
    app.set('view engine', 'html');
    app.set('views', __dirname + '/views');

var mongoclient = new MongoClient(new Server("localhost", 27017));
// error occurs here
var db = mongoclient.db('course');

app.get('/', function(req, res){  
   // Find one document in our collection
   db.collection('hello_combined').findOne({}, function(err, doc) {
      if(err) throw err;
      res.render('hello', doc);
   });
});

mongoclient.open(function(err, mongoclient) {
   if(err) throw err;
   app.listen(8080);
});
Run Code Online (Sandbox Code Playgroud)

当我运行此代码节点app.js时,我有以下错误:

sabbir@sabbir-pc:~/nodejs/hello_express$ node app.js

 /home/sabbir/nodejs/hello_express/app.js:12
 var …
Run Code Online (Sandbox Code Playgroud)

javascript mongodb node.js ubuntu-14.04

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

angular ajax:位于0的JSON中的意外标记I.

我试图发送htmljsonhttp post request.但是当我试图提出$http.post请求时,我遇到了以下错误:

angular.js:12783 SyntaxError: Unexpected token I in JSON at position 0
    at Object.parse (native)
    at fromJson (http://localhost:9001/bower_components/angular/angular.js:1274:14)
    at defaultHttpResponseTransform (http://localhost:9001/bower_components/angular/angular.js:9703:16)
    at http://localhost:9001/bower_components/angular/angular.js:9794:12
    at forEach (http://localhost:9001/bower_components/angular/angular.js:341:20)
    at transformData (http://localhost:9001/bower_components/angular/angular.js:9793:3)
    at transformResponse (http://localhost:9001/bower_components/angular/angular.js:10582:21)
    at processQueue (http://localhost:9001/bower_components/angular/angular.js:15097:28)
    at http://localhost:9001/bower_components/angular/angular.js:15113:27
    at Scope.$eval (http://localhost:9001/bower_components/angular/angular.js:16359:28)
Run Code Online (Sandbox Code Playgroud)

我的代码(角度)如下:

  $scope.generate_pdf = function() {
    var html =  angular.element('html').html(); // get all html

    var service = API.getService();
    // JSON.stringify( { html:  html } this also cause same error
    service.downloadPdf({}, { html: …
Run Code Online (Sandbox Code Playgroud)

javascript ajax json angularjs

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

更新 dynamoDB 中的数组项

在我的dynamoDB中,我有一个表,其结构如下所示:

 var params = {
      "TableName" : "pdfs",
      "Item" : {
          pdfid:  // Partition key
          html: [] // array attribute
       }
 };
Run Code Online (Sandbox Code Playgroud)

我可以插入新的数组数据,就像给定的代码一样:

插入数组数据

 var params = {
      "TableName" : "pdfs",
      "Item" : {
          pdfid: pdfid,
          html: [event.html]   // here "html" is an array, I just insert first array data
       }
 };

 dc.put(params, function(err, data) {
     ............................
 });
Run Code Online (Sandbox Code Playgroud)

如何更新数组dynamoDB

  var params = {
      TableName: "pdfs",
      Key: {
         pdfid: event.pdfid
      },
      UpdateExpression: "SET html = :html",
      ExpressionAttributeValues: …
Run Code Online (Sandbox Code Playgroud)

node.js amazon-dynamodb

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