Accessing individual records from dataset received from Silverlight RIA service - ria

I am a newbie to silverlight & wcf ria service and am only finding examples where the dataset received from calling the domain service query is bound to a datagrid. I want to be able to access each record individually, without the dataset being bound to anything. How may I do that or does every data in silverlight need to be bound? Example: I call getlocations() and then need to iterate through each record and get the geographical points associated with each location.

Okay. I was trying to access the records before they were finished being retrieved (the async operation was not complete). So I transferred the function that uses the data to the event handler of the domain service load method, and then the function worked okay.

Related

Creating custom metric descriptors continually results in HTTP 500

I think I've broken my project's custom metrics.
Earlier yesterday, I was playing around with the cloud monitoring api, and I created a metric descriptor and added some time series data to it using the latest python3 cloud monitoring library create_time_series call. Satisfied with the results, I deleted the descriptor using the library, which threw an error as I had incorrectly passed in the descriptor's name. I called it again with the correct name, and it succeeded, but now every call to create_time_series on this project fails with an HTTP 500. The error message included simply says to "Try again in a few seconds," which I have, to no avail.
I have verified that I can create time series data on other projects of mine, and it works as expected. The API Explorer available in google's API documentation for metrics also gets an HTTP 500 back on calls to this project, but works fine on others. CURLing requests yields the same results.
My suspicion is that I erroneously deleted the custom.googleapis.com endpoint in its entirety, and that is why I am unable to create new metric descriptors/time series data. Is there a way to view the state of this endpoint, or recreate it?
It is impossible to to delete the data stored in your Google Cloud project but deleting the metric descriptor renders the data inaccessible. Also, according to data retention policy, there is a deletion of this data when it expires.
To delete your custom metric descriptor, call the metricDescriptors.delete method. You can follow the steps in this guide.
You are calling CreateMetricDescriptor every time when you call CreateTimeSeries. Some or all of these calls specify no metric labels, and these calls are therefore overwriting the metric descriptor with one that has no labels. The calls to ‘CreateTimeSeries’, on the other hand, do specify metric labels, causing the metric labels to be auto-added to the descriptor.
Custom metric names typically begin with custom.googleapis.com/, which differs from the built-in metrics.
When you create a custom metric, you define a string identifier that represents the metric type. This string must be unique among the custom metrics in your Google Cloud project and it must use a prefix that marks the metric as a user-defined metric. For Monitoring, the allowable prefixes are custom.googleapis.com/ and external.googleapis.com/prometheus. The prefix is followed by a name that describes what you are collecting. For details on the recommended way to name a custom metric, see Naming conventions.

Where to put loading of HashTable

I have an nodejs application having some REST APIs and is working well.
One of the API, say /billinginfo POST, receives a client code and a piece of data via JSON format, and it will make a API call, to another service, say /client GET, that returns country of the client, and it then inserts the data into the database.
I later found out that, for performance improvements, I can actually load all the client's countries into a HashTable 1st with key being the client code with one API call that return all the clients and avoid calling that /client GET API many times and will look into the HashTable instead.
My question is now, where do I normally put codes loading the HashTable to be used by the /billinginfo POST API?
Update:
The country and the client info is on AWS AURORA in the cloud of another system and /billinginfo POST is writing to a on-premise MS SQL database hence I must make calls to /client GET API.
I think what you can do is put the data of countries in your database and put the proper indexing, and after that query from your database.It'll be quicker than calling third party API.

Data is being entered twice when cross domain web service is fired

I have created a .net web service and when i try to call a method that saves the data in the database, the request is fired twice. I use net profiler to check if two requests are made to the server but only one request is made to server. I fail to understand why data is being entered twice in the database.I am using jsonp method to call the cross domain site
I just found something interesting. I have two servers. When i host the web service on one and call the web service using cross domaining, the data is entered once whereas on the other the data is entered twice. Do we need to take care of some IIS settings too?
So, if there aren't two requests being made then there are almost certainly two calls to the Save() method (or whatever it is called), being fired from the web service end point. But there maybe dupliacte data somewhere too.
Here are a couple of things to check:
What data is actually being
transferred? Have you checked this
using a tool like Charles?
Is the data being passed to your Save() method the same as the data being passed to the web service?
How is the data being written to the database? Is there duplicate SQL somewhere?
Heyi all, i just converted my project to visual studio 2010 and then installed it on the server. Everything is running perfectly now. Thanks

Multithreading using Wcf

HI i am new to the the whole programming thing, i have been given a task to multithread 4 stored procedures where each thread runs asynchronously so that the user can get output real quick i have to do it using WCF can anyone help me out with this. Initially what i am trying to do is taking each procedure and getting how much time it takes to execute using parametrizedthreadstart, but i am not sure how to go about it.
Considering you are new to the whole programming thing, you can follow these very basic steps to get thing done.
Create a new WCF service.
Add 4 methods each calling one stored procedure.
Add parameters to the methods which are required by stored procedures.
For Example if your stored procedure is - MySP(varchar name) then your WCF method will
be - MySP(string name);
Now depoly your service in IIS or windows service or Console App or wherever you want.
Create a client application, again it could be anything ConsoleApp or Win Form etc.
Add a reference to your service.
Instantiate service class and call there Async version. By Async I mean there you'll
see all of the four methods with Async attached.
For Example you will find your MySP(string name) method as MySPAsync(string name)
Also there will be MySPCompleted event, subscribe to it.
Now all of your methods are running asynchronously whenever they finish execution they'll call your subscribed methods.
I hope this helps you get started :)
There are a couple of different ways to do this. At the highest level, you can place each service request in it's own service endpoint. This could be defining endpoints for each method, or if you are hosting in IIS, placing each service it's own website. At the lower level, you could define callbacks for each method so that WCF will not block while the method calls are taking place.

SharePoint webpart connections

Is it possible to have a bi-directional web part connection? I am aware that a web part can be both a provider and a consumer but it seems only one connection is allowed between two web parts.
What I am trying to accomplish is a bi-directional connection where a field in web part A can update web Part B and a field in B can update web part A.
You can do this in several ways.
The main things to understand are:
You're in complete control of the interface the web parts share
By default only the consumer knows anything about the other web part
Here is then a couple of ways to implement what you describe:
Option 1: Pull/Push:
You can make your interface such that the consumer can pull the information it needs by either calling function or getting property values
And the consumer also pushes the information the other webpart might need by calling functions or setting property values.
Option 2: Consumer announcing
Here you define your interface (and way of using it) such that when a consumer get's a connection it make a call back through the interface to give the producer a reference to the consumer. This reference can then implement the same or another interface any way out want.
Now both the consumer and the producer has a reference to another web part where they can get the information they need.

Resources