Can someone suggest simple JSON parser for C++ Windows VS 2010, possible which can be used for commercial purpose without licensing issues.
The requirement is to
Fetch and package the data in JSON from C++ program,
It would be transferred over network (TCP socket) and would further be read from Android device.
The data is to be sent is light, not very heavy.
Thanks.
Boost and its property tree library can create and parse JSON.
Related
I can't find any deep information about how UWP apps are actually running.
I read on Wikipedia that UWP is based on WinRT. WinRT incorporates some kind of .NET runtime. Is it CLR? Is it some form of CLR or what?
UWP has nothing to do with .NET or the CLR. It is implemented in C++ and uses COM under the hood. It is language agnostic, meaning its API can be consumed by different languages (C#, VB.NET, F#, C++/CX, C++ and JavaScript right now).
If you're using C# to consume the UWP APIs, then the UWP types are projected into equivalent CLR types. For example, if you instantiate a Windows.Web.Http.HttpClient instance, not only do you get a CLR System.Object back, but under the hood the underlying COM object is "activated" a-la RoActivateInstance (or something like that).
I need to make a Windows Store application that exchanges xml serialized data over a TCP connection with a server. Since I need to use Direct3D rendering in the application I went for the c++/cx store application template however I ran into issues with xml serialization/deserialization.
My usual approach in C# would be to use the XmlSerializer and classes with DataContractAttribute annotations. However as soon as I try to import System.Xml.Serialization assembly I get the C1114 error - WinRT does not support #using of a managed assembly. However there are lots of examples that mention using this approach in a Windows Phone app from C#.
So the question is - is only c++/cx limited in support for .NET in Windows Store applications and C# can use all the standard components on phone as well or is switching to C# in this case also not a solution and I need to use the WinRT classes for xml serialization/deserialization?
Your confusion is understandable, what with the variety of frameworks Microsoft has put out there.
C++/Cx is a native binding to the Windows Runtime (WinRT). It does not use any managed code or the .NET framework in any way, which is why you're getting the C1114 error.
C# provides a managed binding to WinRT. It does leverage the .NET framework, so in a C# Windows Store application, you can make use of some of the base-class library. This subset is referred to as the .NET Profile. This article talks about this more: http://blogs.msdn.com/b/dotnet/archive/2012/04/17/net-for-metro-style-apps.aspx
In your specific case, you are using a C++/Cx application because you want access to Direct3D. This makes sense, although it means that you will not have access to System.Xml.Serialization. Instead, as you surmised, you will need to use APIs that are available to C++/Cx to read XML, specifically Windows.Data.Xml.Dom: https://msdn.microsoft.com/en-us/library/windows/apps/windows.data.xml.dom.aspx
I am really a beginner in delphi, as the client request the project to be done in delphi, so I have to ask to get some help as possible as I can. This project will be involved in HTML5 and websockets as well, so there are some questions I need your advices.
Sorry let me explain more, this application have two parts mainly, one is HTML5 client web app (this app will be loaded from web server, and run locally in browser), and the other is its service located in server. The HTML5 web app is doing some product editing job, as well send its final output to server, during this process, there will be many communications between client app and service, and I planed to use Websockets.
I did plan this application in HTML5 and Node.js before, but as client send request to ask for the Delphi XE as primary development tool also it will be compiled to DLL (ISAPI, have to be) at last. For consistency of UI, I also was required to use uniGUI (http://www.unigui.com/demo)for Delphi. Now I have these questions:
Is there any other way to do this application with HTML5 as web front exclude uniGUI in Delphi?
What good libraries support Websockets in Delphi?
What book you can recommend me to read, as I don't know Delphi at all.
Thanks.
1: yes, make a "single page app" (static html + js) and communicate with server using xml or json.
At least with indy 10 it is quite straight forward to implement static file serving (response.contentstream := tfilestream.create(sfilename) or something like that)
2: yes, if you search for it on google you will find some :)
WebSocket server implementations for Delphi
btw, I'm busy with delphi socket.io implementation, which makes it easier to use websockets instead of plain low level tcp-like websockets itself
Is there any other way to do this application with HTML5 as web front exclude uniGUI in Delphi?
First concept : HTML5 applications are a bunch of HTML files and JS's wich can be processed by browsers.
Second concept : You need an application that can bind HTTP queries and return files from the first concept.
Third concept (paradigm) : With first two concepts, a third concept arises. Dynamic HTML. What is dynamic HTML? HTML that generates at runtime at the backend server and/or at frontend with JS.
Solution :
Yes, with Delphi as a backend server you can manipulate and return HTML5 views, if you know (MVC paradigmn for example) you can program an HTTPServer application that binds HTTP request from network and responses your HTMLs and JS.
What good libraries support Websockets in Delphi?
You need a multilayer library. The best library I know is mORMot. mORMot is like a swiss razor for Object Pascal.
You can create an HTTP server with websocket published interfaces. mORMot's Site
What book you can recommend me to read, as I don't know Delphi at all.
I have more than 10 years with Delphi and Free Pascal and I didn't read a book at all. But I read a lot from internet and a lot of computer architecture and another languages like C and C++.
If you like Delphi there are tons of documentation via Internet. I cannot recomend you a book because I will lie you.
I need to wrap a C library with Adobe AIR native extension API (ANE).The extension should target IOS and Android.First,I realize that for Android , if not using NDK API , I have to port that library to Java.But my main concern is IO operations like read and write to file system which exist in that library.I read through the ANE development manual but found no note on restriction of native lib communication with the host file system.Does it mean my native library is allowed to read and write files inside AIR extension freely ?
You definitely can access the filesystem to read and write files.
The only thing of note here is that you'll only have access to the parts of the filesystem that the application has permission to access. So you basically just have to obey any restrictions that a normal native application developer has.
I've used the java.io.File to access files in ANE's no problem.
Based on what I see scanning through that too it reads to me like it's doable but I can't confirm 100%
When you create a native extension, you provide the following:
ActionScript extension classes that you define. These ActionScript classes use the built-in ActionScript APIs that allow access to and data exchange with native code.
A native code implementation. The native code uses native code APIs that allow access to and data exchange with your ActionScript extension classes.
sounds to me like you have whatever native API available for writing your native extension in and they're just providing a "bridge" or "data tunnel" to communicate between the actionscript code and the native extension. They have one import from the android library for log in their example as well so I imagine you can use whatever objects/methods are available for each platform, I suppose the only real question is then what access the native process has on the file system for each platform. If you don't get an answer please try and post back (if I have time I'll do the same).
I used xml services for post and retrieving data from webservices. I dont know about JSON parsing, whether JSON is easy than xml.
That depends, do you plan on supporting other platforms?
The .Net based platforms have more than ample resources for easily consuming services that are hosted with a variety of serialization methods (and many other variances). If you only plan on supporting Windows Phone or other .Net based platforms than you may find that XML Serialization is easy and can stick with it. When you start to consider other platforms then you may find that Xml serialization can at times be a pain and JSON is the preferred way.
If you want to go with JSON parsing in addition to the JSON serializer that comes with the .Net platforms you may also want to check out JSON.Net (which is much more flexible than what comes with the .Net libraries) and RestSharp for consuming REST based services with JSON serialization.