Function is calling before service loaded - web-services

I am using blazeDS in my web application. I am facing issue with Java and flex.
I have used function to load service in creation complete event of application. And I need to get value in combo box and do some manipulation. But my function which will trace the value, is being called before service is loading. for that reason function is not returning any value.

you can overcome by doing following changes
1) call webservice in Application initizlize event
2) Call your method in ResultEvent triggers on result of Webservice
or
3) IF Still you face same issue you can call it using callLater()
or
4)IF callLater() wont work to, then you can use Event collectionchange of ListCollectionView a Parent Class of ArrayCollection, XMLListCollection
I personaly recommend DO Steps 1 and 4 Only.
Hopes that helps

Related

Only aysnc methods lsited when call wcf

I am trying to call a WCFService from Windows phone 8 which connects and returns data fine when i use WCFTestClient but when I refreence the service using add reference and then try to access in code only the async methods are showing in intelesence. I have not delciared my methods as aync how can i ensure I can access my other methods as I calling a webservice does it need be aysnc.
// Constructor
public MainPage()
{
InitializeComponent();
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
IcuroServiceClient _db = new IcuroServiceClient();
var json =_db.GetPersonByIdAsync(1);
}
And if so How would I convert a method that is as simple as below to Aysnc ?. I am used to asmx services and new to WCF.
public string GetListByUserId(string userId)
{
List<curoList> myList = _db.GetAllListsByUserId(userId);
var json = JsonConvert.SerializeObject(myList, Newtonsoft.Json.Formatting.None);
return json;
}
Its grayed out here for me mate In my normal signature im returning a string but the asyncs dont look like their returning anything just void .
Windows phone is based literally and figuratively on the Silverlight motif of keeping all service calls async only. It is a two step process where one has to think backwards. Here are the steps
Provide a callback method whose job it is to handle the resulting data or error in an appropriate fashion.
Then make the call as one normally would (but calling the async version) to start the process off on a separate thread.
Be cognizant of not directly loading to the GUI in the callback method for the result is on a different thread; note that loading to VM properties is fine for the most part whereas the update to any GUI subscribed bindings will be done on the thread.
Hot to Resolve
In the example given before the call to to db.GetPersonByIdAsync(1) provide (find using intellisense) the async subscription method that has the call back.
It may be prefixed with either a Load method or a Begin call, for the PersonById.
In the editor, the providing of a method is usually done by intellisense which where one can tab an example into code. That is so one doesn't have to root out the parameters for the callback method.
Possible example, shows the how to do it:
client.GetPersonByIdAsyncCompleted += MyMethodToHandleResultforGetPerson; // var personId = e.Result;
client.GetPersonByIdAsync(1);
Why
When Silverlight was designed, having a program wait (even if its busy waiting) on any thread would slow down the browser experience. By requiring all database (service) calls to be asynchronous ensures that the developer can't slow down the browser, in particular by bad code. Loosely speaking that motif carried over to the windows phone where Silverlight was brought over as the main operations for the phone.
It took me awhile to get used to the process, but now that I have worked on Silverlight and Windows phone, I actually use the async motif in WPF even though I don't necessarily have too, it makes sense in terms of data processing and thread management.
It is not easier for the developer per-se for everyone learns in a synchronous hello world, but it is adapted for the needs of the target platform and once learned it becomes second nature.

DialogBoxParam() method is not invoking GUI in IE 9 or above

I am VC and VC++ developer. I use VS2008.I have developed an API for capturing the fingerprint through a biometric scanner, in VC. After capturing the fingerprint, I need to display the fingerprint image to the user. So I used DialogBoxParam()method to create a GUI. I have 3 modules. First is the Core DLL, Second is the Windows Service and the Third is Scanner DLL. For capturing the fingerprint, I used to give request from core DLL to the service the will contact the Scanner and revert us back. After the response from the service I call DialogBoxParam() method to show the fingerprint GUI. I have used GetForegroundWindow() to bring the GUI to the front of the browser. In Windows 7, IE 9 or above, the DialogBoxParam() method gets failed. If I avoid GetForegroundWindow(), DialogBoxParam() method got succeeded. I cannot find the solution for this problem. Please help me in this. Below is the code to create the GUI.
*
DialogBoxParam(GetInstance(),MAKEINTRESOURCE(IDD_FEATURE_DIALOG),GetForegroundWindow(),(DLGPROC)WndProc,
NULL);
*
DialogBoxParam return -1 and GetLastError return 0 in ActiveX Control

C++ / C call method from running software

I would like to use C++ / C to call a method of an running application. So it should work the following way:
An application is running, let's say Chrome and another application is running (plugin.exe). The other application should call a Chrome c++ method from the outside. Is that possible?
The method that I would like to call is the method displaying auto suggests. I would like to develop an omnibox with multiple keywords.
Somehow I would like to hook into the application and send / receive events and call methods. I guess event reeving can be done, since it's possible to use the Microsoft debugger with an executable and catch a lot of events.
While researching a bit I found out how to load a dll plugin in Chrome:
https://developer.chrome.com/extensions/npapi
I've done the same in Pepper API as well, but from there I can't reach any further.

COm server accessing the application

I have written a simple dialog based MFC application using a thirdd party soft tree control. I am trying to write a automation client for the application. For this I wrote a singleton out-of-process COM Testing Agent for the dialog based application sample app. The Com server exposes a Run method to the automation client. This Run method access the gut of the mfc app and actually mimicks a click on the GUI. The problem i am facing is when the automation client tries to invoke Run method on the Com object it is able to invioke it but when the Run method crashes when it tries to access the control's methods such as getCaretInedx.
I have tried to cach the exception and log the message to a file but have not been able to do so.
My question is: Is there any limitation in the way a com object can access the application? Or am i missing anything to facilitate this.
Any help or pointer is greatly appreciated. Since this is my first in COM I have not been able to make much progress.
Thanks
Is your client's window actually being created? If not, the hwnd doesn't exist, which is probably why it crashes. Furthermore, your client may be hidden behind another window when it is started, and may exhibit different behavior than when the user called it through regular interaction.
In general, calling code that relies on or interacts with the UI from a COM server is fraught with peril, especially when that code is not written in the first place to behave like this. Most UI isn't that defensive about HWND's existing etc.

Calling a function after another function is called

I'm programming a controller for use with Ableton Live 8 using the Python-based API. In my code I use a method provided in the API to watch for changes in a property's value, and call a function whenever the value changes. My goal is to change the color of the clip when the value change is noticed.
I have my code completed, and it compiles without error. From Ableton's log:
742234 ms. RemoteScriptError: RuntimeError
742234 ms. RemoteScriptError: :
742234 ms. RemoteScriptError: Changes cannot be triggered by notifications
742234 ms. RemoteScriptError:
It appears this is the result of using the built-in notification system to make a change to the live set during notification. Triggering the actual change AFTER the listening function has finished executing should work. Is this possible using Python?
Edit for clarification:
currently we have
value change noticed, function called
function attempts to change the clips color (results in error)
we need
listener notices value change, function called
function finds the new color value
function execution ends
another function is called outside the listener's scope, and changes the clips color
I did a lot in M4L and know this error by heart :)
I'm afraid you can't do anything about that - to my noob eyes it looks like a built-in security mechanism so you can't loop (Something changed? Change it! Something changed...).
In M4L i used Javascript Tasks to separate the steps (Tasks forget nearly everything),
something like
Observer -> Something changed
Create a Task that reacts
task.execute() or task.schedule(time)
Maybe the python threading module can achieve something similar?
BTW, if you happen to understand anything about the _Framework-Tasks, let me know.
I was having the same issue trying to delete a track from a clip stop listener, then I found this thread and followed #user2323980 suggestion.
There seems to be a "_tasks" object on every Framework class (I found it throught log_message inside ClipSlotComponent and ControlSurface) that handles concurrency between tasks. And it's really simple to use it:
self._tasks.add(Task.run(func, args))
I found some uses of it on Push and MK2 scripts, those are good references.