I've started with Flex recently, I've noticed that some plugin for Visual Studio exist, instead of buying a licence for another program (Flex Builder).
I was wondering how I could manage to remotely connect to my database with a Flash/Flex application with the help of C#/Asp.Net.
If I've correctly understood what I've read in the last few days, there is basically no way to 'query' to a database with Flex 3. So I suppose there is another way by using a webservice in C# on the database server that would respond to the Http query from Flex.
Am I right or totally of the track? If you have any other thoughts about this, please share.
I prefer (and recommend) using Webservices for the communication between Flex and C#. It's easy to use, and they both support serialization, so you can easily transfer Strong-Typed Objects. More on Flex and .NET can be found at http://www.adobe.com/devnet/flex/flex_net.html
Alternatively, you could consider using WebORB. This program functions as a gateway between and Flex, and enables you to use the Flash RemoteObject API for the communication to C#. More on this can be found at http://www.adobe.com/devnet/flex/articles/flextodotnet_remoteobject.html.
You really should consider using FluorineFx.
It takes about 5 minutes to set up an will allow Flex to call your methods like a service. You can then pass classes back and forth from .NET to Flex and back.
It's also the standard form of communication by Adobe, it's free and it's super fast.
Your understanding is correct. Flex is intended for developing client-side applications, and communication with a database is done through a server-side application.
Pretty much the same as building a JavaScript application. Though, Flex has several additional options for communicating with the backend. Webservices are great in a lot of cases, but the other options are worth looking into.
Here's a pretty happening article on the topic, if you haven't already seen it.
http://www.dehats.com/drupal/?q=node/33
Related
We have a background service, which has the single purpose of getting recent data from a server.
Now the server should be an OPC-UA server. Unfortunaly, the SDKs and examples I found to connect to this are limited/only explained in ways that are heavily integrated with a classic windows forms application. Up to the point where its impossible to separate GUI from business logic.
At this point I'm wondering if we are misusing the client functionality and should opt for a different way?
Ideally I'd like to wrap the whole OPC-UA Logic inside a class library and just call GetData(), is that impossible?
You are probably referring to the "SDK" provided by the OPC Foundation - but you have not stated that explicitly in your question; in fact, you used the term "SDKs", in plural. There certainly are also commercial SDKs which might be better in this respect.
Here is one (QuickOPC), together with one-liner example of reading the OPC UA data: https://www.opclabs.com/products/quickopc/opc-specifications/unified-architecture/generic-data . Disclaimer: This is a self-promotion.
You might find Tutorials for Client development, specifically Console Client useful. This is a much better SDK than the one from the OPC Foundation. You will find full C# samples including a console client application (no GUI).
You might want to re-evalute your needs for
Ideally I'd like to wrap the whole OPC-UA Logic inside a class library and just call GetData(), is that impossible?
It is totally possible, but with OPC-UA, you have to keep in mind that it is recommended to get data using a subscription model (Monitored Items) instead of performing an explicit Read for a value (unless you just want to read an attribute once). So, I would make sure that however you are building your client-side class makes sense for the needs of your application.
I have a smart device (Windows CE 2013) that just got the requirement to be controlled from a number of different devices, to do this, we decided to serve a web page from the device that allows it to be controlled.
I've also read that compact framework doesn't support ASP.NET so I'm intending to serve a static webpage that contains a javascript application that calls web services hosted on the device.
I also found this link explaining how to serve a SOAP Service in C++, but it seems old, and I'd prefer to do this in C# as it's my preffered language and I already have some code on it
I'm not quite happy with this solution, am I missing something? Can't I really do this in C#?
You could try this library for .NET https://github.com/ServiceStack/ServiceStack .
It is a free in case if you are using branch v3 form a github.
There's nothing built-in in the CF that provides web server capability. Windows CE has always shipped with an HTTPD server, but, honestly, it sucks and can't be integrated with managed code anyway.
We solved this problem long ago by creating our own IIS-like web server implementation (available commercially). You could do something similar as well - it's just a lot of Socket work. That trivializes the complexity of concurrent request handling and providing an IIS-like object model, but you get the idea. Basically you have to write the whole thing.
The main answer to this is to use Mongoose (or the MIT-licenced equivalent Civetweb). They are C webservers designed for just your task - an embedded web server.
They are really easy to implement, 1 C source file added to your project, give it an array of options, and you're done. See the examples. It has plenty of features and is fast, and small (40kb compiled!). They say it takes 5 minutes to get going with it, and they're right - I tend to use it to add webserver functionality for normal applications now.
I'm working on project that will work real time: I have to write a video streaming client-server app, this server will to send the AVI/MPEG etc to an web application. I have some questions:
What is the protocol recommend to do this, http? rtp? or other?
In the web application, how do I to show it to user? using an flash player,java applet(I don't ensure if it's possible with it) or HTML5, what is the best way to do this currently?
I hope this is clean for you. Any help is very appreciadted. Thanks in advance. :)
There are several different ways to implement this (some that require programming and others that don't). Which one you choose depends on your requirements.
Red5 is an obvious solution which will allow you to only have to focus on the web side as long as your player of choice is flash.
FlourineFx provides a similar environment for .NET with a little more effort.
I've also done this with IIS and a custom server using HttpListener with much success if you're set on a pure Windows/C# solution. The caveat I'd add here is that it isn't always simple. In an environment with limited throughput, you will have problems since HTTP doesn't have the time corrections that RTP/RTMP/RTSP have but in a decent network it works 3 9's of the time (I've only tested with a single player though).
UPDATE
If you're talking about live streaming with .NET I'd suggest looking into the DirectShow (or related DirectX) API's. There is a wrapper for it for .NET available called DirectShow.NET.
I am a c++ developer and need insight with current project...
I have a C# .net application that I want to securely connect to a mysql database
I have a sql database created and have created a "webservice" using php that I supposedly can connect to and through that it will access my sql database
but Need some insight into how to talk to this php code
Also would like to hear thoughts on this metholidgy ... is this best practices for doing this? (most secure, fastest, what about hundreds (thousands?) of users accessing a database will this hold up?)
My end result is to have this run on mobile platforms (android, ios) using Unity3D
I am trying to get the basic running using .net 3.5 c# so I understand it before I have to port it to mobile platform and the .net subset with unity
If someone would help me outside of the scope of answering these questions, I am always willing to pay to get this figured out
A great choice that would be very easy to implement in PHP and C#, as a bridge, would be Web Services built using JSON as the interchange format.
This looks like a good basic introduction for a JSON PHP Web Service.
This is another in C#.
With a neutral interchange format you should be able to connect the two components with ease.
I prefer to use JSON.NET and it works really well with JSON object serialization. Though JSON serialization is built into the core framework now (since .NET 3.5).
+1 on using JSON, but only if actually needed.
You can treat 'talking' to the php code as any other webservice. Create your api on the server side (ie. what the scripts do, what params they need), then forget the implementation when writing the client code.
Think about security. If you'll be exchanging sensitive information, you may want to encrypt it. So... SSL.
Do you have user-specific data? You may want some kind authentication.
One easy solution, if you're an optimist, may be to use a private salt and hash your parameters to make sure requests are coming from code you have distributed. However, this won't stop one user to pose as another.
As for scaling, it all depends on just how many calls you do, how many concurrent users you have etc., only you can estimate this stuff. Getting a cloud account would be good. Set up everything on one box at first. As traffic increases, move the database on a new node, then add a webserver, a master-slave setup, a load balancer..etc.
I think it's a nice approach, just be very careful with authentication and security. Performance shouldn't be an issue as long as you optimize the access to the database (performant queries, caching on the client and the service if necessary).
As for the web service consuming in C#, you should use service references for SOAP web services, or HttpWebRequest for REST web services.
For more information on the subject, this kind of architectures are called Service Oriented Architectures (SOA).
We've got some problems with an external company trying in integrate into a WCF service we expose and they are a Java shop. I was wondering if there are more than one toolkit that they can try to solve their issues and would like a list to suggest to them but I'm not familiar with the Java world at all.
Essentially they've got some memory leak (apparently!) but they are very sketchy in the details.
Microsoft and Sun worked together to ensure that their latest web services toolkits worked with each other. Sun's java implementation is Metro.
Are they using Axis, if you are presenting a standard webservice to them? Or are you presenting a custom REST service that they have had to do more manual coding for (HTTPClient, XML generators/parsers, etc)?
You need to ensure you're using a normal web service binding and nothing else. I admit though over the years getting java and .net web services to play nicely is no mean feat. A memory leak by the way, would have nothing to do with calling your web service and everything to do with the way the external company is managing their memory. You're not executing anything on their servers after all :-)
I've done this successfully with Axis. It was actually pretty straight forward, using the Eclipse plugins.