Code Monkey home page Code Monkey logo

discussions's Introduction

Gitter

discussions

need help? or just wanna ask a question? open an issue on this repo!

If you're having trouble installing a workshop on Mac or Linux, check out this guide https://github.com/nodeschool/discussions/wiki/Installing-global-node-modules-(Linux-and-Mac)

NodeSchool organizers can have discussions over here. If you want to create your own NodeSchool workshop, have a look at the workshoppers repo.

TOC
When you have a problem
 In general: 1 - Be nice, 2 - Be public, 3 - Be patient, 4 - Non-English is okay
 Suggestions: Check your installation, Provide full command output, Use markdown, Say thanks!, Close your issue, Bikeshedding
About Labels
Answering Issues: Use links, End with a question, Reformat issues, Apply priorities, Close issues

When you have a problem:

👉 Check out the FAQ! 👈

In general

1 - Be nice

All of the workshops and all of the discussions are done by volunteers and there is no guarantee that all questions get answered. If you only provide negative feedback and not constructive criticism your issue will probably get closed with no response.

2 - Be public

Don't email workshop authors directly, use the public discussion forum (the Issues) for all communication, that way your question and any answers you get can benefit everyone else.

3 - Be patient

It may take a day or two for people to respond here. Please don't send multiple messages in a row, it won't help your question get answered any faster.

4 - Non-English is okay!

If you can't read or write english well its better to write additionally your question in your native language. There are many people on this site and maybe people can help you in your mother-tongue. It may take slightly longer for somebody to reply to your question if it's not in English, though.

Suggestions

Check your installation

Often the installation on windows makes problems. But also other systems can experience troubles. Please also check out the installation suggestions if you have problems.

Provide full command output

To help us debug your problem please include all output from the commands you ran, including any error messages you received.

It also helps to include your node, npm, git or other CLI command versions, which you can get by running node -v, npm -v etc.

Use markdown

Github offers a lot of support to format your issue. It makes it easier for other people to understand your problem.

Say thanks!

The person that helped you did it out of the kindness of her/his heart. Tell your appreciation by saying thanks 😄 !

Close your issue

If you don't close your issue another person will have to clean it up later.

Bikeshedding

Its okay to bikeshed issues but if you do it would be nice to update it every 14days or so to let people know you still have interest.

About Labels

Only owners can add labels to the dicussions issues. We added a lot of labels that makes it easier for contributors to understand the content of an issue. There are labels that correspond to each nodeschool adventure, as well as some others, here are their intended meanings:

Label Meaning
bikeshedding This issue is kept open in case someone wants to jump in. It should be updated every now and then (~14days).
chapter request This label is for issues that are chapter requests.
contains hints for improvements This contains hints on how a workshopper/tutorial/website etc. can be improved. The issue should be closed when the improvement was added to the content in question as a PR or issue.
discussion thread This label is for threads that discuss other nodeschool related business.
general node.js This is a question not specific to a content in this repository but rather to node.js in general.
installation This is an issue with the installation of node or a workshopper.
mac This is an issue specific to computers with Mac OS X.
meta For issues that have to do with the running of nodeschool.
migrated For issues that have been migrated to another relevant repository.
needs some love This issue is not simple to answer or process. More effort than average needs to be put into this issue and it needs the love and support of the greater community.
probably self resolved This label is for the case that the person that asked the question has not answered for a longer period of time (~14 days). It should be used by the person who closes an inactive thread to show that she/he thinks that the user probably resolved this issue himself. Usually only closed issues should have this label.
question This issue contains a question that is not a problem.
seems resolved This label is to indicate that the issue seems resolved but the user forgot to close the issue. Usually only closed issues should have this label.
waiting for feedback This label is to remember that the issue has been answered but is waiting on additional information or more response.
windows This is an issue specific to computers running Windows.

If you have an issue that doesn't match a label, feel free to open an issue suggesting new labels!

Answering Issues

If you have an answer to a question please don't hesitate to add a comment, even if you're never answered one before! There are people who answer issues regularily but those are also volunteers and also only try to do their best.

It is not necessary to follow this but there are some things that we found useful to keep in mind:

Use links

Many questions are similar. If you can link to other issues or web content that makes your life easier. Keep in mind that the other person still needs an explanation why you give this link.

End with a question

If you add a question at the end it puts the ball back to the initial questionee and indicates that you think that this comment should fix the issue of the person. i.e.:

  • Could you try that?
  • Does that help you?
  • Does that solve your problem?
  • Do you need more information?

Reformat issues

Owners can edit issues. It is often not a good idea to change the issues but adding Syntax Highlighting often helps readability and increases the chances of a good response so that we consider that a good exception.

Apply priorities

In case you feel confident to answer multiple issues it might be a good idea to follow priorities. An example for priorities might be:

  1. Issues with no labels: Add labels
  2. Issues with no comments: Think of an answer
  3. Issues that are least recently updated: Add the waiting-for-response label in case its not given and ask a question in case none has been asked.
  4. Issues that need-some-love: Try to think how to resolve those because they need your love!
  5. Old Issues that are waiting-for-feedback Close them and mark as seems-self-resolved if they are more than a month old

Close issues

If you see an old issue lurking around feel free to apply labels as mentioned above and close the issue if reasonable!

discussions's People

Contributors

a0viedo avatar finnp avatar gitter-badger avatar llkats avatar martinheidegger avatar max-mapper avatar notmatt avatar riyadhalnur avatar sequoia avatar someoneweird avatar suchov avatar sudodoki avatar tgfjt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discussions's Issues

For "Juggling Async", is the solution really this simple?

Here's my solution for this task:

var http = require('http');

http.get(process.argv[2], callbackFunction);
http.get(process.argv[3], callbackFunction);
http.get(process.argv[4], callbackFunction);

function callbackFunction(response){

    var streamContent = "";

    response.setEncoding("utf8");

    response.on("data", function(data){
        streamContent += data;
    });

    response.on("end", function(){
        console.log(streamContent);

    });

}

The problem is that this is identical to the previous task except it has these two lines added:

http.get(process.argv[3], callbackFunction);
http.get(process.argv[4], callbackFunction);

(and removed the printing of number of characters obviously)

Is this sort of defeating the purpose of the exercise or was it supposed to be that simple?

HTTP Uppercaser Socket Hang Up

Anyone know why I'm getting a Socket Hang Up error? Or what it means?
"Error connection to http://localhost:8000: socket hang up"

var http = require('http');
var map = require('through2-map');

var server = http.createServer(function (req, res) {
  if (req.method != 'POST')
    return res.end('send me a post');

  req.pipe(map(function (chunk) { 
    return chunk.toString().toUpperCase();
  })).pipe(res);

});

server.listen(8000);

OpenError - levelmeup - » Basics: BATCH

Keep receiving this error when either running or verifying my answer for the "Basics: BATCH" lesson in "levelmeup" course.
Have tried reinstalling "levelmeup" but it has made no difference...

OpenError: Corruption: 1 missing files; e.g.: /var/folders/t8/xy51q64d5rv89d05qtgzqj8c0000gn/T/~levelmeup_1_8085/000005.sst
at /usr/local/lib/node_modules/levelmeup/node_modules/level/node_modules/levelup/lib/levelup.js:115:19

timers.js error in My First I/O

Issuing learnyounode run node2.js gives me to following error. What could be wrong?

timers.js:103
            if (!process.listeners('uncaughtException').length) throw e;
                                                                      ^
TypeError: Cannot call method 'join' of undefined
    at submissionCmd (/usr/local/lib/node_modules/learnyounode/node_modules/workshopper/workshopper.js:218:35)
    at Workshopper.runSolution (/usr/local/lib/node_modules/learnyounode/node_modules/workshopper/workshopper.js:166:13)
    at Timer.list.ontimeout (timers.js:101:19)

MAKE IT MODULAR succeeds but doesn't acknowledge

It seems to succeed but the verify doesn't seem to complete...

Where am I going wrong?

Cheers.

gareth@shadowrun:~/programming/projects/nodeschool|master⚡ ⇒  learnyounode verify modular.js
Verifying "MAKE IT MODULAR"...

ACTUAL                             EXPECTED
------                             --------
"CHANGELOG.md"                     "CHANGELOG.md"
"LICENCE.md"                       "LICENCE.md"
"README.md"                        "README.md"
""                                 ""

modular.js:

var filter = require('./filter.js')
filter(process.argv[2], process.argv[3]), function (err) {
  console.log( "Error abounds!" + err);

requires filter.js:

module.exports = dirReader;

function dirReader(directory, extension, err) {
  var fs = require('fs')
  var re = new RegExp('\\.' + extension + '$');

  fs.readdir(directory, function (err, list) {
    if (err) return err;
    for (var i = 0; i < list.length; i++) {
      if (re.test(list[i]))
        console.log(list[i]);
    }
  });
};

Incorrect file path to documentation

For the "My First Async I/O" lesson it tells you to look in C:\Users\bbateman\AppData\Roaming\npm\node_modules\learnyounode/node_apidoc.html, which doesn't exist.

I think the correct path would

C:/Users/bbateman/AppData/Roaming/npm/node_modules/learnyounode/node_apidoc/documentation.html

HTTP COLLECT

Here is my code for the 'HTTP COLLECT' workshop.

var http = require('http');
var dataString = "";
http.get(process.argv[2], function(resp) {
    resp.setEncoding('utf8');
    resp.on('data', function(input){
        dataString = dataString.concat(input);
    });
}).on('error', console.error);
console.log(dataString); 

For some reason, the dataString variable doesn't store the http response text. What am I doing wrong? I also tried with array push, and that didn't work either.

HTTP Server doesn't close

Greetings!

Here's my code for the HTTP Uppercaser lesson:

// Required Objects
var http = require('http');

http.createServer(function(request, response) {
    request.setEncoding('utf8');

    if (request.method === 'POST') {
        request.on('data', function(chunk) {
            response.write(chunk.toUpperCase());
        });
    }

}).listen(8000);

I know I ignored the through2-map package suggestion, but I'm trying to wrap my mind around the ins and outs of the the node.js platform as it is — servers, streams, etc..

In any case, when I run or verify the project, the contents come through in upper case, but then it simply hangs until I ctrl+C out of it. Is the learnyounode environment supposed to kill the server, or should I be doing that somehow? I'm just not sure how to figure that all the TCP connections have been made, and it can quit now. :-/

stream-adventure http-server - hanging server

I'm using the following code for the HTTP Server challenge of stream-adventure but the test is still failing.

var http = require('http');
var through = require('through');

var server = http.createServer(function (req, res) {
    if (req.method === 'POST') {
        req.pipe(through(function (buf) {
            this.queue(buf.toString().toUpperCase());
        })).pipe(res);
    }
    else res.end('send me a POST\n');
});
server.listen(8000);

I'm getting this response and I'm left with a node process that I have to kill manually:

➜  stream-adventure  stream-adventure verify 07-http-server.js
ACTUAL                             EXPECTED
------                             --------

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: connect ECONNREFUSED
    at errnoException (net.js:901:11)
    at Object.afterConnect [as oncomplete] (net.js:892:19)

If I kill any running node processes and then run the script manually with node 07-http-server.js, I am able to post to the server with curl and get a correct response but only once, any further attempts to post to the server just hang until they timeout and I have to kill the process again.

I believe the code I'm using is the same as the official solution. Is there a bug somewhere?

I'm running node v0.10.9 and the stream-adventure package was installed yesterday.

BABY STEPS - Not working right

Here is my code:

var result = 0;

for (var i = 2; i < process.argv.length; i++) {
    result = result + Number(process.argv[i]);
}

console.log(result);

This works fine with "node add.js". But if I use "learnyounode verify add.js 12 34", I get some weird errors. Is there a bug in the BABY STEPS challenge?

JUGGLING ASYNC - Unhandled error event

I wrote this code for the JUGGLING ASYNC workshop :

var url1 = process.argv[2],
    url2 = process.argv[3],
    url3 = process.argv[4];

var http = require('http');

var count = 1;

function fetch(url)
{
    http.get(url, function(response) {
        response.setEncoding('utf8');

        var allData = '';
        response.on('data', function(data) {
            allData += data;
        })

        response.on('end', function() {
            // console.log(allData.length);
            console.log(allData);
            if(count < 3) {
                count = count + 1;
                url = 'url' + count
                fetch(url);
            }
        })

        response.on('error', console.error);

    })
}

fetch(url1);

However when I run this code it prints the data from first url but then it gives the following error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: connect ECONNREFUSED
    at errnoException (net.js:901:11)
    at Object.afterConnect [as oncomplete] (net.js:892:19)

Why am I getting that error? how do I get rid of it?

Can't pass 'Make It Modular', 'Your additional module file did not call the callback argument'

Stuck at Make It Modular, and I can't figure out the error.

Here's my module file:

module.exports = directoryReader;


function directoryReader(dir, filter, callback) {

    var fs = require('fs');

    fs.readdir(dir, function (err, list) {
    if (err) 
        return callback(err);

        for (var i = 0, filename; filename = list[i++];) {
            if (filename.indexOf('.' + filter) == filename.length - filter.length - 1 && filename !== filter) {
                console.log(filename);
            }
        }
    });

};

(The check if extension is there if statement is a bit verbose, but I came up with it and so sticking to it).

Verifying this gives me the correct answers:

Verifying "MAKE IT MODULAR"...

ACTUAL                             EXPECTED
------                             --------
"CHANGELOG.md"                     "CHANGELOG.md"                 
"LICENCE.md"                       "LICENCE.md"                   
"README.md"                        "README.md"                    
""                                 ""                             
CHANGELOG.md
LICENCE.md
README.md

But, then I get the error:

Your additional module file:
    /path/makethismodular-module.js
did not call the callback argument.

I see that this guy also got the same problem.

Levelmeup is unable to access provided database dir.

Running `levelmeup verify basicsput.js`` on Ubuntu 13.04 and Debian Sid (both with and without root privileges) produces the following output:

Verifying "Basics: PUT"...

events.js:72
        throw er; // Unhandled 'error' event
              ^
OpenError: IO error: lock /tmp/~levelmeup_1_9543/LOCK: Resource temporarily unavailable
    at /usr/lib/node_modules/levelmeup/node_modules/level/node_modules/levelup/lib/levelup.js:115:19

When changing the default directory in the levelmeup source, the same thing happens:

Verifying "Basics: PUT"...

events.js:72
        throw er; // Unhandled 'error' event
              ^
OpenError: IO error: lock /home/user/nodeprojects/nodeschool/levelmeup/db/~levelmeup_1_9773/LOCK:
Resource temporarily unavailable
    at /usr/lib/node_modules/levelmeup/node_modules/level/node_modules/levelup/lib/levelup.js:115:19```

What am I doing wrong here?

I've checked and I had no problem opening leveldb stores from another node app. I'm having this problem only within levelmeup.

Cannot install levelmeup on Widnows8

got this error after run

> npm install -g levelmeup

npm http GET https://registry.npmjs.org/bl
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
npm http 304 https://registry.npmjs.org/bl
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available too
ls versions are "4.0".
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd 

Module naming recommendations

Do you guys have recommendations for naming these modules so that they are easily discoverable and follow a pre-defined structure?

Always "did not call the callback argument" in MAKE IT MODULAR

here is myprogram.js:

var mymodule = require('./mymodule.js');
mymodule(process.argv[2],process.argv[3],function(err){
    console.log(err);
});

here is mymodule.js:

var fs = require('fs');
module.exports = function(dirname, filter, fn) {
    var reg = new RegExp("\\." + filter + "$");
    fs.readdir(dirname, function(err, list) {
        if (err)
            return fn(err);
        for (var i = 0; i < list.length; i++) {
            if (reg.test(list[i])) {
                console.log(list[i]);
            }
        }
    });
}

and here is the verify result:
image
I did not understand that why it always tell me "did not call the callback argument".
Is it my fault?

small wording issue

From async I/O

so you can check if an error occurred by checking whether the first
argument truthy. If there is no error, you should have your `Buffer`

Should be "... the first argument is truthy."

Select menu doesn't work in WebStom7 terminal.

I tried doing 'learnyounode' from inside the webstorm7 terminal window, and after getting 'hello world' verified the menu got painted without any further actions possible. The flow works fine from regular terminal though.

Error: EEXIST, file already exists /.config

Hi! I'm getting the following issue. I've tried checking the file it says exists... it doesn't seem to.

 ~/dev/ [master*] learnyounode

 /usr/local/lib/node_modules/learnyounode/node_modules/workshopper/node_modules/mkdirp/index.js:74
                    throw err0;
                          ^
Error: EEXIST, file already exists '/Users/revdan/.config'
at Object.fs.mkdirSync (fs.js:642:18)

Any help would be great. I do have a pretty funky install of rvm, is it possible that could be to blame?

Here's the output of $PATH:

echo $PATH
/Users/revdan/.rvm/gems/ruby-2.0.0-p195/bin:/Users/revdan/.rvm/gems/ruby-2.0.0-p195@global/bin:/Users/revdan/.rvm/rubies/ruby-2.0.0-p195/bin:/Users/revdan/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

Time Server result slightly off

My Code:

var net = require('net');
var moment = require('moment');

var server = net.createServer(function(socket) {
    socket.write(moment().format('YYYY-MM-DD HH:MM') + '\n');
    socket.end();
});

server.listen(8000);

Verification Results:

Verifying "TIME SERVER"...
 
ACTUAL                             EXPECTED
------                             --------
"2013-09-23 21:09"              != "2013-09-23 21:34"             
""                                 ""                             
# FAIL

The expected time is correct, while the actual minutes seem stuck at 09. Any idea what I'm doing? These results are so close I'm rather baffled.

Thanks!

Can't install Stream-Adventure

Hi all.
I finished up with learnyounode and now I'm trying to start on Stream-Adventure. Not sure why but I can't get it installed in npm.
I'm on Windows and I've updated Node to 0.10.20.
In the Node.js command prompt I type in
npm install -g stream-adventure

I can see a good portion of the http GET's coming back fine, and then I get...

npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "stream-adventure"
npm ERR! cwd C:\Windows\System32
npm ERR! node -v v0.10.20
npm ERR! npm -v 1.3.11
npm ERR! code ENOGIT

Not sure at all what's going on here. I got learnyounode to install just fine.

Any help is appreciated!

Incorrect Test cases for HTTP JSON API SERVER

A solution for HTTP JSON API SERVER will pass by just returning "send me a POST" when anything which is not a post is sent. Here is the output running on a Mac terminal:

ACTUAL:   "send me a POST"
EXPECTED: "send me a POST"

ACTUAL:   ""
EXPECTED: ""

ACTUAL:   "send me a POST"
EXPECTED: "send me a POST"

ACTUAL:   ""
EXPECTED: ""

ACTUAL:   ""
EXPECTED: ""

# PASS

Your solution to HTTP JSON API SERVER passed!

Here's what the official solution is if you want to compare notes:

-----------------------------------------------------------------

  var http = require('http')
  var url = require('url')

  function parsetime (time) {
    return {
      hour: time.getHours(),
      minute: time.getMinutes(),
      second: time.getSeconds()
    }
  }

  function unixtime (time) {
    return { unixtime : time.getTime() }
  }

  var server = http.createServer(function (req, res) {
    var parsedUrl = url.parse(req.url, true)
    var time = new Date(parsedUrl.query.iso)
    var result

    if (/^\/api\/parsetime/.test(req.url))
      result = parsetime(time, res)
    else if (/^\/api\/unixtime/.test(req.url))
      result = unixtime(time, res)

    if (result) {
      res.writeHead(200, { 'Content-Type': 'application/json' })
      res.end(JSON.stringify(result))
    } else {
      res.writeHead(404)
      res.end()
    }
  })
  server.listen(8001)

-----------------------------------------------------------------

meetups?

I'd like to encourage people to run "nodeschool meetups." Basically just a room where people work through one of these and have someone around who's passed all the levels to help them.

I was thinking that it might be cool to add something to the end of all the games, after all the levels are passed, that says "Congradulations, Are you interested in teaching others?" and link them to a document that helps them organize a nodeschool meetup.

Thoughts?

LevelMeUp: Basic Get ENOENT Error

Here's my code:

var level = require('level');
var path = process.argv[2];
var db = level(path);

var checkValue = function(error, value, index) {
    if (!error.notFound) {
        console.log(index + '=' + value);
    }
};

for (index=0;index<100;index++) {
    db.get(index.toString(), checkValue(index));
}

Whenever I try to levelmeup run this, I get the following error:

Error: ENOENT, no such file or directory '/usr/lib/node_modules/levelmeup/node_modules/level/node_modules/levelup/'
    at Object.fs.lstatSync (fs.js:679:18)
    at feed (/usr/lib/node_modules/levelmeup/node_modules/echomunge/dir2gibberish.js:8:17)
    at random (/usr/lib/node_modules/levelmeup/node_modules/echomunge/dir2gibberish.js:33:5)
    at setup (/usr/lib/node_modules/levelmeup/problems/basics_get/setup.js:14:58)
    at Workshopper.verify (/usr/lib/node_modules/levelmeup/node_modules/workshopper/workshopper.js:102:3)
    at Workshopper.init (/usr/lib/node_modules/levelmeup/node_modules/workshopper/workshopper.js:78:17)
    at Object.<anonymous> (/usr/lib/node_modules/levelmeup/levelmeup.js:15:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

I installed the level package globally and the last lesson that uses it ran fine. Maybe I'm just doing something in my code that's causing this?

I will admit I'm not confident I'm doing the proper syntax for passing an additional parameter to the checkValue function. I know it receives error and value, but I need to pass the index, too, so I know the key. :-/

Thanks!

How to scale node.js+socket.io application?

i have tried everything but i am failed. i have tried clustering, socket.io-clusterhub, socket.io redis store, with http-proxy and nginx. but i am failed. please guide me. i want to achieve 1m users concurrency how is that possible?

Meet Pipe errors due to read access

Got this error trying to verify my meet pipe lesson:

fs.js:427
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES, permission denied '/usr/local/lib/node_modules/stream-adventure/problems/meet_pipe/data.txt'

Easy enough to correct by running sudo but may trip people up. Perhaps the verify command here should copy data.txt to a tmp dir.

verifying "MAKE IT MODULAR" doesn't return any error or success

I am trying to use my code for "FILTERED LS" as a module. It works fine but command learnyounode verify use-filtered-ls-module.js doesn't give any error or success notification. Following is the output
kumar@mylaptop:~/sandbox/node-js/learnyounode$ learnyounode verify use-filtered-ls-module.js
ACTUAL EXPECTED


"CHANGELOG.md" "CHANGELOG.md"
"LICENCE.md" "LICENCE.md"
"README.md" "README.md"
"" ""
kumar@mylaptop:~/sandbox/node-js/learnyounode$

And the code in use-filtered-ls-module.js is

var my_module = require('./filtered-ls-module.js');
my_module();

And in filtered-ls-module.js

function filteredls(){
var fs = require('fs'),
path = process.argv[2] || "";
if(path.length === 0){
return;
}
if(process.argv[3].length !== 0){
var extension = new RegExp(".(" + process.argv[3] + ")$");
}else{
return;
}
fs.readdir(path, function(err, list){
if(err){
return;
}
var listsize = list.length,
i = 0;
for(;i < listsize; i++){
var filename = list[i];
if(extension.test(filename)){
console.log(filename);
}
}
});
}
module.exports = filteredls;
module.exports = function(){
var fs = require('fs'),
path = process.argv[2] || "";
if(path.length === 0){
return;
}
if(process.argv[3].length !== 0){
var extension = new RegExp(".(" + process.argv[3] + ")$");
}else{
return;
}
fs.readdir(path, function(err, list){
if(err){
return;
}
var listsize = list.length,
i = 0;
for(;i < listsize; i++){
var filename = list[i];
if(extension.test(filename)){
console.log(filename);
}
}
});
}

Baby Steps - Node works, verify fails

Here's my code:

var sum = 0;

for (index = 2; index < process.argv.length; index++) {
    sum += Number(process.argv[index]);
}

console.log(sum);

Here's a node test:

node baby-steps.js 1 2 3
6

Here's the verify:

learnyounode verify baby-steps.js
Verifying "BABY STEPS"...
 
ACTUAL                             EXPECTED
------                             --------
""                              != "130"                          
null                            != ""                             
# FAIL
 
Your solution to BABY STEPS didn't match the expected output.
Try again!

Am I missing something? :(

Make It Modular Error

My Make it Modular code gets the correct output but then fails with the error "Your additional module file:
file_filter_module.js
did not return the correct list of files in an array as the second argument of the callback."

I've looked at my module and the solution module and I can't see a functional difference in the two modules. My code is pasted below.

function filterFiles(dir, ext, callback) {
    var fs = require('fs');

    fs.readdir(dir, function (err, files) {
        var fileList = [];

        if (err)
            return callback(err);

        files.forEach(function (file) {
            var fext = file.slice(-1 * ext.length);
            if (fext === ext) {
                fileList.push(file);
            }
        });
        callback(null, fileList);
    });
}

module.exports = filterFiles;

`learnyounode help`

I've just added a new feature to workshopper that points people to the help file if one is supplied by the workshop, after you select an exercise:

 » For help with this problem or with learnyounode, run:
   `learnyounode help`.

The text is a combination of the workshopper usage.txt and the file supplied by the workshop application. The one for learnyounode is here, please let me know if you think the text could be improved--PR's greatly appreciated.

The full text looks like this:

Usage

  learnyounode
    Show a menu to interactively select a workshop.
  learnyounode list
    Show a newline-separated list of all the workshops.
  learnyounode select NAME
    Select a workshop.
  learnyounode current
    Show the currently selected workshop.
  learnyounode run program.js
    Run your program against the selected input.
  learnyounode verify program.js
    Verify your program against the expected output.

Having trouble with a learnyounode exercise?

  A team of expert helper elves is eagerly waiting to assist you in
  mastering the basics of Node.js, simply go to:
    https://github.com/nodeschool/discussions/issues
  and add a New Issue and let us know what you're having trouble
  with. There are no dumb questions!

  If you're looking for general help with Node.js, the #Node.js
  channel on Freenode IRC is usually a great place to find someone
  willing to help. There is also the Node.js Google Group:
    https://groups.google.com/forum/#!forum/nodejs

Found a bug with learnyounode or just want to contribute?

  The official repository for learnyounode is:
    https://github.com/rvagg/learnyounode/
  Feel free to file a bug report or (preferably) a pull request.

HTTP JSON API works once per connection

So here's my code:

var http = require('http');
var url = require('url');

var time, query, isoTime, chunk;

var server = http.createServer(function(request, response) {
    if (request.method === 'GET') {
        response.writeHead(200,{'Content-Type':'application/json'});
        query = url.parse(request.url, true);

        switch(query.pathname) {
        case '/api/parsetime':
            time = new Date(query.query.iso);
            isoTime = {
                'hour': time.getHours(),
                'minute': time.getMinutes(),
                'second': time.getSeconds()
            };
            response.end(JSON.stringify(isoTime));
            break;

        case '/api/unixtime':
            time = new Date(query.query.iso);
            chunk = {"unixtime": time.getTime()};
            response.end(JSON.stringify(chunk));
        }
    }

    request.on('end', function() {
        response.end();
        server.close();
    });
});

server.listen(8000);

My issue is that when I connect (either on my own or use learnyounode run), I can perform only one GET, and the second one fails due to disconnect. Also, I'm aware that the server isn't closing.

I know that it's because I'm using response.end(), but I don't know how else to get the client to recognize the message has been sent. When I just did response.write, it wouldn't work. I know this is because in HTTP 1.0 protocol, the disconnection is what informs the client that it's finished sending.

Can someone please help me in understanding the proper way to do this?

Thanks!

On Time Server task - the difference between the 'net' and 'http' modules isn't very clear

nodeschool starts you off using the http module for tasks, then switches you to net for Time Server. They both have createServer() functions but the differences between the two isn't very clear. Why are we switching to net for Time Server? This isn't a very easy thing to Google for and being new to node and a lot of these concepts, the documentation doesn't help much either.

For the HTTP Client task, is the callback example accurate?

Where it says:

The 'request' object/Stream that you get from the 'http.get()'

I'm pretty new to this, but from what I can tell, you're getting a response in this exercise from http.get(), not a request.

From the docs: http://nodejs.org/api/http.html#http_event_request
function (request, response) { }

Our callback function is taking the place of the response, not the request. The request is the URL we send as an argument.

I could be totally wrong, the wording just seemed a little confusing to me.

learnyounode baby steps returns a number

// babySteps.js
console.log(process.argv[2])

$ learnyounode run babySteps.js test

returns:

44 (and different numbers each time I run it).

Because the lesson said "Also be aware that all elements of process.argv are strings" , I would expect it to return:

test

stream-adventure HTML Stream validation fails

Running my version seemed to be producing valid results when using 'stream-adventure run'. When switching to 'stream-adventure verify' it reports an incorrect result, but all the expected result lines are null.

To check, I copied stream-adventure/problems/html_stream/solution.js, tried verify again, and had the same result.

I'm running Win7, node 0.10.18

Stream-adventure: Connection refused when verifying http_server

When I try to verify my HTTP server, I get the following error and http_server.js is still running after the verify command exits.

$ stream-adventure verify http_server.js 
ACTUAL                             EXPECTED
------                             --------

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: connect ECONNREFUSED
    at errnoException (net.js:901:11)
    at Object.afterConnect [as oncomplete] (net.js:892:19)

When I run the server using node http_server.js and connect to it with curl I get the expected results.

$ curl -d "test data" http://127.0.0.1:8000
TEST DATA

Any thoughts?

My First I/O

$ learnyounode verify myFirstIO.js anyFakeFileNameHere

passes no matter what nonexistent file I pass as the file path.

LearnYouNode Lesson 6 Solution: Returning and Variable Names

On lesson 6 is there a reason why the anonymous function passed to fs.readdir returns the results of the callback? Is that just to avoid needing to write brackets and an else?

Also naming the second parameter of the module 'filter' is pretty confusing for beginners who may not realize that the function 'filter' used later is a built in method of the Array object and has nothing to do with that parameter being passed.

getting a error with setRawMode(true)

when i go to type in learnyounode.

I get this:

C:\Users####\AppData\Roaming\npm\node_modules\learnyounode\node_modules\workshopper\node_modules\terminal-menu\index.js:59
process.stdin.setRawMode(true);

TypeError: Object # has no method 'setRawMode'

I am also using cygwin for this.

Has anyone seen this before?

Error: EACCESS, permission denied

Howdy.

After running the install: sudo npm install -g learnyounode

I ran: learnyounode

and got this EACCESS error:

`Error: EACCES, permission denied '/Users/myusername/.config/learnyounode'
    at Object.fs.mkdirSync (fs.js:642:18)
    at Function.sync (/usr/local/lib/node_modules/learnyounode/node_modules/workshopper/node_modules/mkdirp/index.js:55:12)
    at new Workshopper (/usr/local/lib/node_modules/learnyounode/node_modules/workshopper/workshopper.js:50:10)
    at Workshopper (/usr/local/lib/node_modules/learnyounode/node_modules/workshopper/workshopper.js:22:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/learnyounode/learnyounode.js:6:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)`

I am running OSX Mountain Lion 10.8.5

Anyone else seen this issue? I am relatively new to command line, so there may be an obvious solution...

my first async i/o

My solution is

var fs = require('fs');
var path = process.argv[2];

fs.readFile(path, 'utf8', function(err,data) {
  var lines = data.split('\n');
  console.log(lines.length-1);
});

However, the verify reports that actual is merely "".
When I run it though, I do see numeric output. Using 0.2.13.
Am I making a dumb mistake?

HTTP File Server runs but doesn't verify

Greetings! Sorry I'm making so many issues. I'm clearly going through the course. :)

So here's my code:

// Required Objects
var http = require('http');
var fs = require('fs');

// Argument Variables
var filePath = process.argv[2];

// Local Variables
var stream = fs.createReadStream(filePath, {encoding: 'utf8'});

http.createServer(function(req, res) {
    stream.pipe(res);    

}).listen(8000);

Here's learnyounode run:

Running "HTTP FILE SERVER"...
 
Shazza got us some butcher my as stands out like thingo. Mad as a sheila how gutful of joey. As busy as a dropkick to shazza got us some struth.

Here's learnyounode verify:

Verifying "HTTP FILE SERVER"...
 
ACTUAL:   "Error connecting to http://localhost:8000: connect ECONNREFUSED"
EXPECTED: "Grab us a billy how it'll be bogan. Lets throw a sook piece of piss grab us a reckon. Flat out like a greenie no worries she'll be right pot."
 
# FAIL

Any idea why it has no problem when I run it, but claims it can't connect when I go to verify?

Thanks!

Creating and publishing a module

My first one will be how to create & publish an npm module. As well as the best practices around doing so (it will assume you have node installed):

  • Create your npm user
  • Create the repo
  • Use npm to create the package.json
  • Use npm to install deps --save and --save-dev
  • Add a license
  • Add a .travis.yml file.
  • Add a README
    • Add a Travis Badge to your file
    • Add a node.io badge
  • Bind Travis to Github
  • Publish the package.

Any other recommendations? Too much? Not enough?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.