Node.js change function async to sync

Almost Node.js‘s libraries are structured asynchronous.

But some app want to returning synchronous.

Below link maybe help you to change function async to sync.

http://alexeypetrushin.github.io/synchronize/docs/index.html


// change to async to sync
var sync = require('synchronize');
sync.fiber(...);
sync(conn, 'query');// conn means mysql connector here.


// original(async)
conn.query([SOME QUERY], function(err, rows, fields) {
if (err) throw err;
console.log('The solution is: ', rows[0].solution);
});


// new(sync)
try{
var rows = conn.query([SOME QUERY]);
console.log('The solution is: ', rows[0].solution);
}catch (err){
throw err;
}

WordPress turn off comments on pages

Settings
>> Discussion
>> uncheck “Allow people to post comments on new articles”
This will affect new posts, but not old.

Access your wordpress database
>> change value of comment_status’s column
of wp_posts’s table to “closed”

If you can access db directly, this can help you

node fibers Assertion failed! floor_thread_key != 0

Microsoft Visual C++ Runtime Library

Assertion failed!

Program:…e_modulesfibersbinwin32-x64-v8-3.14fibers.node
File: ..srccoroutine.cc
Line: 49

Expression: floor_thread_key != 0

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application – JIT must be enabled)

solution: remove 64-bit Windows Installer then install 32-bit Windows Installer
http://nodejs.org/download/

npm Error occurs by Visual Studio Build Tool

C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V120Microsoft.Cpp.Platform.t
argets(64,5): error MSB8020: The build tools for Visual Studio 2010 (Platform T
oolset = ‘v100’) cannot be found.

Solution.1
in Enviroment Variables -> User variables
Variable : GYP_MSVS_VERSION
Value : 2013
and reboot cmd

Solution.2
npm install [module_name] –msvs_version=2013

C# console log

System.Diagnostics.Debug.WriteLine(“MESSAGE”);

Posted by / May 28, 2014 / Posted in C#