IMediaControl:Run return E_INVALIDARG - directshow

in my code, i invoke IMediaControl::Run and Pause couple times.
but sometime the function IMediaControl:Run return E_INVALIDARG, that is so wired, the run function has no argument.
can anybody help me about this;)

Most probably, this error code is returned from one of the filters in the graph, and that's being passed back to your app via the graph manager.

Related

Displaying data from Firebase on load of Ionic app

I'm a beginner in Ionic and Firebase. To learn using ionic+firebase, I'm writing a RandomQuote app to fetch a random entry from Firebase. A reload() method is called when I click a reload button, and the random quote is displayed as expected.
However, I also want the quote to display when the app is loaded, i.e., before I click the reload button. I call the reload() method in the constructor but it doesn't work. I have tried to search for answers on the web but cannot find anything that I could understand. Not sure if I'm searching the wrong keywords or in the wrong domains.
The following is the reload() method that I put in my FirebaseProvider class and called from my home.ts:
reload(){
this.afd.list('/quoteList/').valueChanges().subscribe(
data => {
this.oneQuote = data[Math.floor(Math.random() * data.length)];
}
)
return this.oneQuote;
}
Can anyone give me some hints? Or any pointer to useful books / materials for beginners will also be highly appreciated. Thank you very much.
Data is loaded from Firebase asynchronously. This means that by the time your return statement runs this.oneQuote doesn't have a value yet.
This is easiest to say by placing a few log statements around your code:
console.log("Before subscribing");
this.afd.list('/quoteList/').valueChanges().subscribe(
data => {
console.log("Got data");
}
)
console.log("After subscribing");
When you run this code, the output is:
Before subscribing
After subscribing
Got data
This is probably not what you expected. But it completely explains why your return statement doesn't return the data: that data hasn't been loaded yet.
So you need to make sure your code that needs the data runs after the data has been loaded. There are two common ways to do this:
By moving the code into the callback
By returning a promise/subscription/observable
Moving the code into the callback is easiest: when the console.log("Got data") statement runs in the code above, the data is guaranteed to be available. So if you move the code that requires the data into that place, it can use the data without problems.
Returning a promise/subscription/observable is a slightly trickier to understand, but nicer way to doing the same. Now instead of moving the code-that-needs-data into the callback, you'll return "something" out of the callback that exposes the data when it is available. In the case of AngularFire the easiest way to do that is to return the actual observable itself:
return this.afd.list('/quoteList/').valueChanges();
Now the code that needs the quotes can just subscribe to the return value and update the UI:
reload().subscribe(data => {
this.oneQuote = data[Math.floor(Math.random() * data.length)];
}
A final note: having a reload() method sounds like an antipattern. The subscription will already be called whenever the data in the quoteList changes. There is no need to call reload() for that.

Error During Function. Where does all the data go?

I've developed a function where i use the return function to spit out a list of vectors. Unfortunately there are still a few bugs in my code. Once my function has failed due to error can i recover that list of vectors?
Functions have their own scope, so if a function fails, the function will exit and no return value will be returned. It's difficult to say what's making your function fail without looking at your code. If the failure is due to something you have control of in your code, I suggest you solve it before relying on potentially function bogus results. But if the failure is out of your control (e.g. calling an unavailable external data source) you can wrap your risky code in a try call to recover in the event of an error. I hope this helps.

Why does execve() does not return on success?

I have read the man pages.
All I understood from this link http://support.sas.com/documentation/onlinedoc/sasc/doc750/html/lr2/zid-7281.htm is that
A successful call to execve does not have a return value because the new process image overlays the calling process image
I am not very clear as to why this will happen ? And if the new process overlays the calling process, why does it return on failure only and not on success ?
Because if it fails to do what it is trying to do, i.e. replace the process with the new one, then it makes sense to return, to inform the caller that it failed.
If it succeeds, then the code that called execve() is no longer present, it has been replaced by the successful execution of that function, so obviously it cannot do anything any more. Returning is such a thing.

Conductor API has no attribute "xxxxxx"

I have been trying to add a new table to the database. Now, I have created
the table and I am going through conductor API to populate/update it. I have
defined some function to achieve the task. There function are defined in conductor
and db api, along with in conductor.manage and db.sqlalchemy.api. When I try
to run the system it says
AttributeError: 'ConductorAPI' object has no attribute 'xxxxxx'
while the function is properly defined in Conductor API as well as manager and
db.API. I back traced the flow of the code and it looks like the code reaches till
conductor.api. The function at the conductor API is defined as:
"""In class LocalAPI"""
def xxxxxx(self, context, node_id, values):
return self._manager.xxxxxx(context, node_id, values)
Now, after this it gives the error. Though the function is present in conductor.manager.
Please help me find out why am I getting this error.
So, I figured it out. You also need to add the interface to the conductor.rpcapi and now it's working fine!

Calling Webservices in a loop won't execute the custom OnSuccess function

I have a problem.
I am coding using VS2008.
I am calling webservices from my JavaScript Page.
An example
Services.ChangeDropDownLists.GetNowPlayingMoviesByLocationSVC(
blah,
OnSuccessMoviesByRegion,
OnError,
OnTimeOut
);
after execution, it goes to the function OnSuccessMoviesByRegion.
But if I put the Services in a loop (a simple for loop)
Services.ChangeDropDownLists.GetNowPlayingMoviesByLocationSVC(
blah[i],
OnSuccessMoviesByRegion,
OnError,
OnTimeOut
);
OnSucessMoviesByRegion function won't execute (but the service call executes n times successfully
But I must have the function cos I am returning value through it.
What am I missing?
Is that the typical behaviour?
Any alternatives?
Naveen, I'm answering your follow-up question here. I can think of two options:
Try to make a single call packaging your data (sending the whole blah array and handle it on the server).
Use a counter variable which you decrement in the "OnSucces" client handler each time and stop if this counter variable reaches 0.
I guess there is some kind of concurrency problem. Probably you fire the next request before the last one finished.
I think you'll have to rewrite the loop. Try to move that code, calling only the first request and then using the "OnSuccess" function to call the next one each time.

Resources