Where does node.js fit in a Microsoft / Azure / WCF / MVC project? - wcf

I have been working on a real time data project using the Microsoft stack and it seems that node.js is made for this very purpose (of real time data) and is getting a lot of publicity.
Does it makes sense to integrate node.js into my MSFT solution? (what criteria should I be considering)
How does it "hook into" the project?
What components does it replace?

Steve Marx demo'd this for http://chat.smarx.com/
You can see the basic code at http://things.smarx.com/#Run Node.js -
var proc = new Process()
{
StartInfo = new ProcessStartInfo(
RoleEnvironment.GetLocalResource("Executables").RootPath + #"\node.exe",
string.Format("server.js {0}",
RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["HttpIn"].IPEndpoint.Port))
{
UseShellExecute = false,
WorkingDirectory = RoleEnvironment.GetLocalResource("Executables").RootPath
}
};
but I can't currently find a full blog post from him about this

If you like node, look at Nancy for .NET
http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/

As per this episode of Cloud Cover and the Node.js blog it would appear that Node.js is officially coming to Azure (and probably Windows in general).

I wrote a series of blog posts about running node.js on Windows Azure a few months ago (http://bit.ly/gxHawS). However I would offer a similar caveat that while it's theoretically possible, I'm not sure I would recommend it (at this point)...

Related

Cumulocity - get access to datapoint modal

I'm trying to get an access to datapoints in new cumulocity version. In older version such things as c8yDataPointSvc and schemaPropertiesSvc. I can't seem to find them anywhere. Basically I need components to work with datapoint as in the picture below. I would appreciate any info on how to either reuse those old components or a new way of using them as there is such.
Thanks a lot!
I see here three options. First what I am going to say is that we in Cumulocity use a hybrid approach for our core applications, since we have a lot of functionalities still written in AngularJS. Same as the one that you need. There is no equivalent in Angular yet. That is why you have several options to use those old services.
One is in a hybrid application to you a bridge service where you can define the upgraded c8yDataPointSvc like that -
constructor(
private ng1Injector: any,
...
) {}
get ng1DataPointSvc() {
return this.ng1Injector.get('c8yDataPointSvc');
}
This ng1Injector is a constructor input variable that we define when we provide that bridge service in the upgrade module like this:
{
provide: BridgeService,
useFactory: BridgeFactory,
deps: ['$injector', ...]
}
This way you will still have an Angular application, you will still use the provided from us factory c8yDataPointSvc in your Angular application just by upgrading it using anguar hybrid app upgrade functionality.
Other option is to just keep your widget an AngularJS one and when you have a hybrid app, you can just import the AngularJS widget and the angular compiler will take care of the upgrade/downgrade. This is what we are doing with a lot of our customers, who have angulatJS widgets and are using Cumulocity versions above 10.5.0.*
And the last option will be to not use the AngularJS services you need and using our SDK just implement the functionalities used from c8yDataPointSvc. But that will be the biggest effort probably.

problems in accessing reservoir engineering data using Ocean API

I am building a plug in where I need to access the Reservoir engineering domain data using ocean API. I can access the development strategy using Simulation root but not been able to get the type of development strategy. Whether its history strategy or Prediction strategy.
Any way to know this information.
Unfortunately there is no Ocean API to access the type of the development strategy. I will add your use case to our requirement system.
Regards,
Carole
Having faced multiple limitations in Petrel RE API, and having to go through EclipseKeywordEditor a lot to achieve the goal, I have to say this is an easy one. DevelopmentStrategy.StrategyType property is there to help:
The following code is working for me on Petrel 2012.1:
SimulationRoot sroot = SimulationRoot.Get(PetrelProject.PrimaryProject);
DevelopmentStrategyCollection dsCol = DevelopmentStrategyCollection.NullObject;
if (sroot.HasDevelopmentStrategyCollection)
{
dsCol = sroot.DevelopmentStrategyCollection;
foreach (DevelopmentStrategy strat in dsCol.DevelopmentStrategies)
{
PetrelLogger.InfoOutputWindow(string.Format("{0} is a {1} strat",strat.Name,strat.StrategyType));
}
}
DevGuide doesn't list it, IntelliSense doesn't show it, yet you can bring up Object Browser and see it's actually there (grayed out in fact).

.Net 4.0 MemoryCache Clearing

I am using a .Net 4.0 MemoryCache in my WCF service.
I originally was using the Default Cache as below:
var cache = MemoryCache.Default;
Then doing the usual pattern as trying to find something in the Cache, getting, then
setting into the cache if did not find (code snippet / pseudo code as below):
var geoCoordinate = cache.Get(cacheKey) as GeoCoordinate;
if (geoCoordinate == null)
{
geoCoordinate = get it from somewhere;
cache.Set(cacheKey, geoCoordinate, DateTimeOffset.Now.AddDays(7));
}
I was finding that my entries were disappearing after approx. 2 minutes. Even if my code placed the missing entries back into the cache, subsequent cache Gets would return null.
My WCF Service is being hosted by IIS 7.5. If I recycled the App Pool, everything would work normally for 2 minutes, but then the pattern as described above would repeat.
After doing some researching I then did the below to replace:
var cache = MemoryCache.Default;
// WITH NEW CODE TO CREATE CACHE AS BELOW:
var config = new NameValueCollection();
//Hack: Set Polling interval to 10 days, so will no clear cache.
config.Add("pollingInterval", "10:00:00:00");
config.Add("physicalMemoryLimitPercentage", "90");
config.Add("cacheMemoryLimitMegabytes", "2000");
//instantiate cache
var cache = new MemoryCache("GeneralCache", config);
It seems that no matter what I place into physicalMemoryLimitPercentage, or cacheMemoryLimitMegabytes does not seem to help. But placing the pollingInterval to a large datespan does.
ie: If I set as below:
config.Add("pollingInterval", "00:00:15:00");
Then everything works fine for 15 minutes.
Note: If my WCF service is hosted by IISExpress on my dev environment, I cannot reproduce.
This also seems to happen when my WCF service is hosted by IIS 7.5.
My app pool on IIS 7.5 is NOT recycling.
Has anybody experienced something like this?
I have seen the below:
MemoryCache does not obey memory limits in configuration
Thanks,
Matt
I too have seen this issue and filed a bug with MS here with a simple reproducer project.
This has been resolved by MS in the above bug I filed - with a work around there and an upcoming QFE for .net 4 as well as confirmation that this isn't a problem in 4.5
I have not yet tried the work around
I can however give some more information on conditions required by myself to recreate this. The application pool needed to be in Integrated Pipeline mode for me to see this issue - Classic mode fixes this issue though removes some of the benefits of moving to IIS 7.5.
Equally when using Integrated mode I also did not see this issue if I used a built-in application pool identity such as ApplicationPoolIdentity. However my app needs to run as a custom identity using a service account and it is at this point at which I see the behavior. Therefore if you don't need Integrated mode or a custom Identity you can maybe work around this.
Perhaps the built-in accounts have permissions to do the cache memory statistics gathering initiated by the pollingInterval that my custom Identity does not have, I don't know.
Hope this helps or even that someone else can join more of the dots to figure out a better work around.

Architecture: Titanium Desktop against the Twitter Streaming API

I'm new to Titanium, and have started out by trying to build a (yet another) Twitter client. The problem I've encountered is that I would like to use Twitter's Streaming API, and I'm struggling to understand the best way to do that within Titanium Desktop.
Here's the options I see:
Don't use the Streaming API, it's not going to work.
Build a Python bridge that connects with a httpclient that supports streaming responses (required for the Streaming API, it never closes the connection). Let that client deliver the responses to a Javascript method that formats and outputs tweets as they come. (Problem here: How do I bundle the python libraries I need?)
Use the Javascript HttpClient shipped with Titanium SDK 1.1 in some clever way I'm not aware of.
Use the 1.2.0-RC2 release of Titanium SDK that ships with a HttpClient that has support for streaming responses. There's very little information in the Release notes to judge if the streaming support is enough to get things working with the Streaming API.
Use twstreamer, a javascript library for streaming support through a Flash intermediary. I've seen bug reports stating the Flash does not work well inside Titanium Desktop, but I'd love to be proven wrong.
Another way that I'm not yet thought of.
I'm hoping for all sorts of clever ideas of how I can get this working, and tips going forward. Thanks for reading!
I'm not at all familiar with Titanium, but looking through their docs your best bet is likely going to be to use Titanium.Process to fork something that can deal with streaming responses. There are plenty of lightweight options here, but note that if you want to use userstreams you'll need an option that supports OAuth and SSL
Here's how to do it (after LOTS of testing):
var xhr = Titanium.Network.createHTTPClient();
xhr.open("GET", "https://stream.twitter.com/1/statuses/filter.json?track=<Your-keyword-to-track>", true, '<Your-twitter-nickname>', '<Your-twitter-password>');
xhr.send();
var last_index = 0;
function parse() {
var curr_index = xhr.responseText.length;
if (last_index == curr_index) return; // No new data
var s = xhr.responseText.substring(last_index, curr_index);
last_index = curr_index;
console.log(s);
}
var interval = setInterval(parse, 5000);
setTimeout(function(){
clearInterval(interval);
parse();
xhr.abort();
}, 25000);

Problems creating OData proxy class - connecting to Azure using Objective C

I hope anyone can help me.
My plan was to connect to Microsoft Azure with my iPhone application. I don't have any experiences using http requests with Objective C yet. So I searched all day long on how to use Azure with Objective C...
I found out that one should use OData to create a proxy class which should help to connect to Azure (http://www.interoperabilitybridges.com/projects/odata-client-for-objective-c-%28ios-macos%29).
So I tried configuring like it says in OData's user guide. But I don't understand how to create a proxy class: I tried to compile the odatagen.xcodeproj but I got a Range or index out of bounds error.
However I typed this in Terminal:
./odatagen /uri=https://{serviceNamespace}.serverbus.windows.net /out= users/xyz/Documents[...] /auth=acs /u=myusername /p=mypassword /at=https://{serviceNamespace}.serverbus.windows.net /sn={serviceNamespace} /ups=no
(Of course replacing {serviceNamespace} with the name of my service namespace etc.)
Did I get all those parameters right? I get an mystical error saying fileRange Error While moving xslt file: (null)... :-(
Or am I totally wrong and connecting my app with Azure works with different tools?
I'm sure you could get it working with what you're doing, but Microsoft have done a lot of the hard work for you. Take a look at the Windows Azure Toolkit for iOS on git hub, it's probably the best place to start.