Questions tagged [co]

The Co javascript library for generator based flow-control of asynchronous tasks

Co is a javascript library for executing generators that yield asynchronous tasks, so that asynchronous code can be written in a more concise manner.

114 questions
1
vote
1 answer

reject in promise undefined

I tried below function use co and javascript promise test, the fulfill will success return but reject not, and catch error undefined. and the flow can't continue. why? Error: > at GeneratorFunctionPrototype.next (native) at onFulfilled…
user1775888
  • 2,707
  • 9
  • 37
  • 57
1
vote
0 answers

KoaJs can only stream one connection at once

I'm trying to do something bigpipe with koajs. app.use(function* () { this.type = 'html'; this.body = myPage.stream() // returns a readable }) inside the myPage myPage.prototype.stream = function() { var readable = new…
Qiaosen Huang
  • 945
  • 1
  • 8
  • 22
1
vote
1 answer

how to get readStream with thunk in koa ?

I want to pipe a request in a koa controller, It's work: var s = require('through2')(); var req = http.request(url, function(res) { res.pipe(s); }) req.end(null); s.on('close', function() { console.log('has close'); }); this.body = s; But with…
elrrrrrrr
  • 796
  • 6
  • 15
1
vote
1 answer

How to make yield work with this.req.on('data') without requiring more modules?

Obviously, the reason here is because of the async nature of on('data'), and the combination of using yield, but how can I make this work? I tried "thunkifying" _this.req.on, but to no avail. I'm still getting the hang of generators, yield and…
Jan Carlo Viray
  • 11,088
  • 11
  • 40
  • 59
1
vote
1 answer

Distinction between Coroutines and Generators in Koa context?

The distinction of between Coroutines and Generators is blurry for me. I'd appreciate it if someone could read the article Callbacks vs Coroutines - A look at callbacks vs generators vs coroutines" at…
JLS
  • 681
  • 1
  • 6
  • 10
1
vote
1 answer

Why does thunkify / yield always return an array?

I have a thunk called logInline (adapted from the Co documentation). I notice the thunkified get always seems to yield an array. Is this by design? Is it thunkify doing this, or is it a standard part of yield? var co = require('co'), get =…
mikemaccana
  • 81,787
  • 73
  • 317
  • 396
1
vote
2 answers

How can get x and y position of an image in android on onCreate?

I want current X & Y co ordinates of an ImageView on onCreate of Activity, is there any solution for the same ? Please share your idea on same.
Hiren Patel
  • 48,538
  • 20
  • 161
  • 144
0
votes
0 answers

I am Trying To Put Textbox Value To Cookie Using JavaScript and Get This Value Back After Refresh

I am Trying To Put Textbox Value To Cookie Using JavaScript and Get This Value Back To the Text Box After The page refresh But It Isn't Working. document.getElementById("submit").onclick = function() { //get var configvalue =…
0
votes
0 answers

Trying to return from co generator runner in nodejs

I want to create a function that runs asynchronous code sequentialy. This function takes parameters and returns a Promise that resolves with a JavaScript object. It uses the co npm package in conjuction with generators to "pause" asynchronous code…
0
votes
0 answers

How to create dynamic columns in database table using codeigniter

How to create dynamic columns in database table using codeigniter $data = "create table tbl_pricebook_" .$product_id . "( pricebook_id INT NOT NULL AUTO_INCREMENT, product_id VARCHAR(100),"; …
Sreeraj
  • 1
  • 1
0
votes
0 answers

Dataframe subsetting on a variable with the same value

I have a simple data frame like this: col1 col2 a 1 b 2 a 2 I'll refer to this data frame as table. I am trying to create variables a1 and a2 where the value of a1 would be 1 in this instance and the value of a2 would be 2.…
0
votes
0 answers

How do you delete an element from an array in C++?

I'm trying to make a program of choosing numbers and deleting arrays after. How do I delete an element of an array in a code? #include #include using namespace std; void main() { int array[4]; array[0] = 1; …
user12548653
0
votes
1 answer

What causes the SVN error "Revision xxx doesn't match existing revision yyy..."

I'm using a recent version of SVN to check out some files (using 'svn co URL DEST'). When I do this, I get an error that says "svn: E155000: Revision 11134260 doesn't match existing revision 11075284 in DEST". However, if I use a 2011 version…
Brett
  • 11
  • 4
0
votes
1 answer

I have a co routine that once selected plays through. However If i go to select it again nothing happens. It does work the first time however

I have a co routine that once selected plays through. The co routine scales an object up. The second one it's selected it scales down the object. However If i go to select it again nothing happens. It does work the first time however. using…
jono
  • 33
  • 8
0
votes
1 answer

How to solve permission problem in laravel

I've got problem about laravel permission. I'm trying to retrieve data from database using laravel. But on my page, I am getting this error message: UnexpectedValueException thrown with message "The stream or file…
yepsolutely
  • 738
  • 1
  • 6
  • 26