How to save ios object or view parameters to server? - mysql

What is the best way to save object parameters to DB in ios? => like sending values to server application and server will save the parameters to db? And later that ios-app will get the properties and create the new object again.
What is the best way to do it? For ex, saving CALayer or UIImageView attributes like size, position, color, border width etc..

You have to create a data model which defines what this data looks like.
Once you have it, you will need to define some sort of REST api against your server to get/post/put/delete this data.
To implement this network layer you can look at:
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/Articles/UsingNSURLSession.html
AFNetworking and RestKit are other useful libs to consider
To store locally you can look at CoreData - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html

Related

How connect json file with after effects for rendering dynamic video

I wan't to learn how connect some json file with after effects for rendering dynamic videos.
Eg i have a form in some webpage:
this form included one input which people are using there their name.
And then i create some json file like that array of objects with this form.
data = [
{
name: 'John'
},
{
name: 'Mike'
}
]
and i wan't to create with these json objects for each name some video about few second there will be shown just name from json and render some mp4 video.
How to do that?
which steps following?
if it will be web form i think i'll need to connect json file dynamically too right?
so after effects will read this json file from some url ?
There are many ways to go about doing this, but a single answer on Stack Overflow probably won't give you everything you need.
Network communication can be done using the CEP framework provided by Adobe which can then execute ExtendScript code which actually does the manipulation of the layers inside the AEP project file. You can use node modules to perform the network communication, and then write ExtendScript code to pass in the JSON data to that.
While not free, you might want to explore Dataclay's Templater extension to help you accomplish what you want. It not only does what you are asking out of the box, but it has some rules-based AI to reconfigure layers both temporally and spatially. You can point Templater to a URL that response with an array of JSON objects and have it process that data. In addition to this, it has event hooks which allow you to execute any script within the Shell or with the ExtendScript engine during its versioning process.
Hope this helps!

Flutter: rendering an UI from JSON and store / map data dynamic

I want to render a UI from a jSON string that has multiple layers.
The user should be able to enter data, which will then be stored and shared, without the overhead of the jSON Render Structure.
However, the assignment of the data must be possible.
The app renders a template from a multidimensional json string that can capture metrics (user inputs). The measured data are entered via text fields by the user.
There are different windows in the app, which are rendered from different json UI-render-files.
The stored algorithms in the windows at the Frontend differ.
The following should be possible:
All windows are created with different jSON strings (works with build_value now).
The user's input is saved. (Currently only works by saving the render json string with the data under a different name (with Package: Shared Preferences)).
The data entered by the user is copied from one window to the other window. (Data Binding / Data Mapping)
The data entered by the user will be sent to a backend.
I only have the idea to use id's in the render json, which allow a mapping.
Are there better solutions?
Saving the entered data is possible by saving the whole jSON - String with an other name.
The goal is to map the data.
It should also be possible for the user to insert another object for the measurement data acquisition at the client / device. The entered data must also be saved.
This sounds like a REST API. Then you would use a frontend framework like angular or react to take user input.
I could build this with a .net core web api with sql db as the backend. this would be a web service (REST API solution) on the backend of your solution.
Next I would integrate Swagger with dependency injection and add authentication.
now its time to create the front end that will use your tested Web Service.
you would have 1 side of your SPA POST new JSON to the Web service in a form.
you would have the other side GET the new record as a new tab with pagination or in a table with pagination.
This would be a good PoC for your idea and will let you learn the parts of the solutions architecture in your language of choice. the "design" would be the same no matter what language your choice.
backend web service can be done in a flask and with a MySQL DB. or with any other combo you have skills with.
the Frontend could be done in knockout.js, making it a little easier to learn than angular or react.
Please create new questions when you choose your software design. I would love to give answers for each:)
I would love to level up with you! ;)

Angular 6: create my own database while using a database from public api?

I am working on an angular 6 project and I need to know if I can get a database from a public api but also from an in-memory database?
Which means for example show movies from a public api but also be able to add my own movies so that it shoes on my website.
I just want to create a basic database that when I reload the page, the database disappears.
If yes, how can i do so without using backend?
Thanks
Ava
I really don't know if I understood your question properly but I thought of sharing some info which might be useful for you.
You can use the browser's local storage to temporarily save your data. And if you want your database to disappear when you reload, you can manipulate with logic to clear your local storage from the code. Like, onInit of the component, clear local storage.
Use json-server if you want a small data base. It actually serves as a real database
There are some public api sites, where you can fetch data, and even mock post and put requests too. For instance json placeholder
To be able to extend that data, you need the specific implementation to always extend the result with your "in-memory database". So for instance in a component, you store your data in a property, and in the http communication listeners do something like this:
this.http.get('placeholder-api',{someBodyData}).subscribe(
response => {
results = [...response, ...myInMemoryDbArray]
}
);
If you post the specific function you want to implement and has difficulties with, can help you more.
I think you can use firebase. For tutorial https://www.tutorialspoint.com/firebase/ .

How can I use charlexproxy's map local to model a response which consists of an image file and json using map local

Charles proxy question.
I need to model a response from an API call using map local. I've done this before, but in this case the API is both returning an image, as well as JSON.
Is it as simple as creating two map local functions for the same call, one returning the required image, the other the required json?
If not, what's the best way of doing this, if it's possible at all that is?

How to disable content negotiation and always return JSON from WCF data service?

Let's say I have a northwind database and I use ADO.NET Entity Data Model which I automatically generate from the tables in database. Then I add a new WCF data service that inherits from DataService. When I start the web application, that runs the service I can request data like this:
http://machine/Northwind.svc/Orders
This will return all orders from order table in atom/xml format. The problem is I do not want XML. I want JSON. I think I tried all kinds of settings (web.config) and attributes in my application, but I still get XML. No matter what. I can only get JSON, when I use fiddler and change the request header to accept JSON.
I do not like the concept of content negotiation. I want always to return data in JSON format. How can I achieve that?
Keep in mind that I did not create any model objects, they are automatically created based on database tables and relationships.
Well - content negotiation comes with HTTP. In any case, you could intercept the incoming request and add/overwrite the Accept header to always specify the JSON. There's a sample how to support JSONP which uses a similar trick, I think you should be able to modify it to always return JSON as well. http://archive.msdn.microsoft.com/DataServicesJSONP.
The behavior you criticize is defined by specification of OData protocol. OData defaults to Atom and client can control media type of the representation either by Accept HTTP header or by $format parameter in query string (but I'm not sure if WCF Data services already support this).