Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 months ago.
Improve this question
I've almost 'finished' my first website. Which consists of an authors anthology, essentially 100's of pages containing individual articles. It's built with HTML and CSS.
At the bottom of each page I want to link to related pages, displaying the title and an image. How can I auto-populate these boxes by fetching related pages from a database?
I'm just looking for someone to point me in the right direction, I will try to teach myself. I assume there would be some server side scripting? or loading the data into a sql?
There are two approaches.
Lets compare and contrast!
1. Server Side:
You write code on the server (in PHP or Python or Java or whatever) to create HTML files programmatically, which will have the relevant links.
Pros:
You are in full control
Cons:
Resource intensive (relatively speaking)
Longer initial loading time (waiting for server to create a new page, per request)
It's the way it was always done.
2. Client Side:
You write code on the client (browser) that receives from the server just the data (perhaps JSON?), and figures out how to display it on its own. Perhaps using Angular, or React.
Pros:
Very light-weight on the server
HTML pages can be hosted cheaply (S3, DropBox, what have you)
Cons:
Content is fetched and analyzed on the fly, making the page feel slow if you're not careful
Bloats the front end, kinda harder to grasp
As a sub-topic of the Client Side, There's a new hotness in town, and it's called Serverless. You don't have to write a back end, and you focus 100% on the front end.
If you really have to make calculations outside of the users browser you can use cloud functions (like Amazon Lambda), but I don't think that's your use case.
For your use case, you can access a database straight from the front end, without needing any back end. See: Firebase.
You'll need some sort of server side program. Something that can query the database, then return the results either through an api or process it all server side and return the html. Below are some frameworks that can help.
Java:
Play, Spring, Javalin, Dropwizard, etc.
Python:
Django
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have a device that sends data to a FTP server. In OM2M, I want to implement an IPE to access this data and send it to MN-CSE.
Currently I am fresher on oneM2M standards And as per the below reference I found the 2 alternative for this task.
The ftp server notifies your AE (it is constrained for us to not to make any change on FTP server configuration so we are unable to go with this approach)
Your AE implements the ftp server and would then be able to directly react on new data events.
Here I just want to adopt the second approach so if possible can I get any reference so that I can proceed with that as there is not such documentation available that I found on Internet. Or kindly mention if there is any other approach that best suits to oneM2M standard for this issue.
And I just want to get confirmation that if we are monitoring FTP server periodically for the incoming input file and then process them and send them to MN-CSE then whether this approach suits to oneM2M standards or not ??
OneM2M: IPE that periodically fetches device data from FTP server
This question is indeed about different integration options. In general, it is one or more Application Entities (AE) that operate with the resources / data in a CSE. Every tool, application, protocol gateway, or "adaptor" is, from oneM2M perspective, an AE.
A special form of AE is the IPE, the Interworking Proxy Entity. It is used to connected another system or infrastructure to a CSE and mediate between these two worlds. The CSE part, ie. the protocol and the data formats etc, are covered by the oneM2M specification, and the other part must then implement the other protocol and technical specifications. The actual task is then to convert the data and expected behaviour between both worlds.
I am not sure from your description whether what you are planning is such a protocol "gateways", or just push the data received via an ftp server to a CSE. But technically, this doesn't matter much for the oneM2M part: You need to define how the data is structured on the CSE etc anyway.
For the data retrieval: As you mention in your question there is a third option to the other two:
The AE monitors an external system for new or updated resources, and pushes them to the CSE as soon as when they are ready.
From oneM2M's perspective this is completely fine. Technically you must make sure how to find out when the data is new, completely received, still valid, etc. ... basically all the challenges when you are polling resources. The first two options would be more helpful because you would avoid some of the problems that come with polling, but as you wrote sometimes you just don't have control about the system you want to connect to.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
i'm making a blackjack game in java,
and i'm not sure whether i should send the images of the cards from the server to the client every time or just put all the images files in the client and just use their names.
on the one hand sending the images might make the programming a bit messier and make the program run a little slower,
but on the other hand i don't want to let the client be able to mess up things from his side.
this code isn't for production but it's important for me to put emphasis on security and stability.
i'll be glad to hear your opinions, thanks :)
You are on the right track. If you send the images, it will slow down your app and make the code more complicated. If you load the images from a local repo, a user could replace those files with their own images.
If you are focusing on security, you could put the files locally and encrypt them. It would be difficult (read: impossible) to replace the files with images that decrypt properly without the key. An attacker however could switch cards (ie. replace an ace with a 10 just by changing file names). To avoid this, instead of just encrypting the message encrypt the tuple (card value, image). That way you can verify after decrypting that the value is the one you expected. This is all well and good given no one knows the key used to encrypt / decrypt. Therefore, you will need to hide the key (send it over the network, hide it in memory, etc). Also, encryption and decryption does take time, so it will slow down your app. This won't be as noticeable as when you are sending images over the network, but it will be there.
If you go down the path of sending the images, there is still a possible attack vector. An attacker could intercept the network packages and send a different image to your client. To avoid this, you will want to use an encrypted protocol. Many common protocols have encryption options.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
In our GWT web application, we reach a state where we want to remove everything and just show a big fat warning that the application was stopped.
We are not able to figure out a way to do that. What we basically need is:
force GWT to stop all processing and abort any existing RPC messages
force all registered events to become inactive
clear all visible content from the page
set a single paragraph/text
In a nutshell, we want to kill the entire DOM and add just a single paragraph to it.
We tried many different combinations of
RootPanel.get().clear()
but found no reliable way to do what we want to achieve. Any ideas how to do that?
First of all you have to take of server activities. That's a good practice, which makes your application robust.
To make it uniform, you probably want to respond with appropriate exception to any requests made to your Service implementations. For instance, if that's what happens when user is removed rights to access the application, then it should probably throw some kind of security exception for all requests except those made for relogin or other approved actions.
You can do it manually in every service method or you can have a filter that handles that. Frameworks such as Spring Security provide an easy way to configure security filters.
After you've done with server side and confirmed that UI is unable to penetrate through server's security layer, you can make changes to UI. There are different ways to make a nice looking blocking screen.
In general, I do the following in my code to create content and can use clear() method to remove viewport or stuff from the viewport. No refresh or revalidation needed.
Viewport viewport = new Viewport();
viewport.setLayout(new FitLayout());
viewport.add(new MainPanel());
RootPanel.get().add(viewport);
Not sure how your layout is. If you're able to provide a code sample for your scenario, I can show you how to do what you need. Because in my examples it works just fine.
Window.Location.replace("URL-OF-A-STATIC-HTML")
Javadoc :
Replaces the current URL with a new one. All GWT state will be lost.
In the browser's history, the current URL will be replaced by the new
URL.
If you want to re-activate the GWT app, put a link on that HTML page.
Store information or say flag in the cookies, when ever u load the application see that whether that cookie is set, if it is set display the message or else load the application. Now whenever you want to stop the application completely, set the cookie and reload the application.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How would one go about sending and receiving simple data such as a string from an app inside a cell phone?
Essentially, though it is not my goal, I am asking how one would create a text messaging service.
My current idea is to buy some online storage from a data-center store the string in there, alone with their intended recipient, and whenever the recipient checks the app the strings are sent him.
I would like to know if this method is possible, or if it there is a better method, or software to help me?
Additionally if this method is possible and preferable please point me in the correct direction to begin.
There are lots and lots of ways to do this. It all depends on what knowledge you have on web servers etc.
For sending to the device you could use GCM (http://developer.android.com/guide/google/gcm/index.html)
However this doesn't do from the phone, only to it.
You could set up a simple web server...
You need an HTTP server, almost all languages have one, for simple servers, if you don't need much throughput then try something like python, otherwise have a look at Apache or something. http://httpd.apache.org/
For a cleaner and more structured way of sending these strings I would use JSON, so the web server will need a JSON layer to handle JSON requests, have a look here: http://www.json.org/
Once you have the request you will need to do some logic with it, this is up to you. But as soon as you get the JSON request and parse it you should be able to do almost anything with it.
This all should be really easy to implement. Then if you were to make it public (I would develop this by running the server on a local machine) then you need to have a static IP at your house, by a domain, and set it up so that the domain is pointing to your IP, if your IP is dynamic it may take a bit more to set up but you will need to look into something like FreeDNS and an updater client.
Otherwise you could just find hosting that supports the language you are going to be using (PHP, ASP.NET, or what ever) and then get something set up with them.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to create a server which initially checks an Android applications trial period, so
on running an Android application the phones info is sent over to ther server.
The server stores this information.
Whenever the application is opened within that android phone
the server checks its trial period has or has not expired.
In a way it's like an Android time bomb.
I'm completely new to servers and really just want a basic, secure, server that simply registers a phone and compares it against a trial limit.
Anyone have any information on how I could do this?
Any code examples or tutorials are very much appreciated.
You didn't specify your server technology, but in principal you need to do the following:
You probably want to expose them as a REST Webservice. All you need is a GET operation to basically figure out if the trial has expired or not. Since you are using Android and have gained familiarity with Java, I suggest you look at JAX-RS which is one way to implement REST in Java. If you are familiar with other language, then feel free to go for that.
The simplest form of your GET URL would probably look like http://yoursite/getTrial/[beginTrialDate] where [beginTrialDate] is a date in millis since Jan 1, 1970 GMT (standard approach)
On the server side, you simply took the [beginTrialDate] and check if it has exceed your trial period by comparing current time to [beginTrialDate] + [trial period]
You would then return a simple JSON response containing the information whether the app has expired or not. The simplest form would be: { "hasExpired" : true/false }
You would call this WebService in Android using HttpClient as you would probably know already. Check this HTTP Client Tutorial
You could make the server more robust by storing the phone identifier and your GET URL change to http://yoursite/getTrial/[phoneID]. The only additional complexity is you have to look up the begin trial date by phoneID and then compare it again using the step #4
Let me know if you need more clarification and I will add it to the post
Easiest way would be write a JSON service. here is a link to a sample PHP JSON service - http://davidwalsh.name/web-service-php-mysql-xml-json
You can easily find JSON code for your choice of language.
I'm guessing that you dont need the service to return lot of data - probably a flag or minimal data. You could simply parse through the JSON string that is returned to the device. If you have lot of data to be passed, you could try some free JSON libraries available