Using AFNetwork on a local server? - json

So I have configured a raspberry pi to use as a hotspot, but the Pi does not have internet access. It should only serve as a hotspot for me to connect through wifi in order to get access to the server I have stored on the raspberry.
I then want to get data from the server, as json, using AFNetwork. The problem is that I get the error code that I don't have an internet connection. I am connected to the raspberry and can view the data on it, but I can't seem to get the data to my app using AFNetwork.
I'm using this example project: http://www.raywenderlich.com/59255/afnetworking-2-0-tutorial and I've changed the base url to an url displaying json through 192.168.etc. If I simply paste the url in the browser I see my json data. Is it possible to use AFNetwork like this or does it require an internet connection?
Thanks!
Edit: I tried going online and doing a request to an url containing json data and it worked fine. So not having internet connection seems to be the issue for AFNetwork.

Update: Seems like the problem was with the Simulator in Xcode. It didn't really like to switch between different networks, so closing it and opening it made the connection possible. In case anyone else is trying to do the same thing.

Related

Angular 8 Route Refresh gives 404 on Deployment Server

i am developing the application using Angular 8. I am facing an issue on the deployment server. When i make a build and deploy it to the server. If i go through its index point then its working fine but if i refresh any route then its giving me 404 error. kindly suggest me the best solution.
I implemented the hash strategy too on my local and checked on iis windows its working fine but i need some other method so that url will not look ugly. In this strategy a hash always would be there in the url.
So please tell is there any other way to do it.. without showing # in url..
Please experts help me to fix this as like angular.io because on that if you refresh any route then its work good without hashing strategy...
I usually use hash strategy but, as I know it is possibile to configure your server (for example via .htaccess file) in order to configure your routing. I don't know how by the way.

Forge ARKit: Cannot load model in Unity

With the latest ForgeARKit-update-6-2018.1, I was trying to load my model in Unity, with the sample Unity scene 'loadAtStartup'. I can successfully load the sample models from 'Sandbox', but I couldn't load my model, which was uploaded through script 'test-2legged'.
Error message shows 504, it seems not reaching the service:
AsyncRequestCompleted The remote server returned an error: (504) Gateway Time-out.
UnityEngine.Debug:Log(Object)
Autodesk.Forge.ARKit.RequestQueueMgr:AsyncRequestCompleted(Object, AsyncCompletedEventArgs) (at Assets/Forge/CodeBase/RequestQueue.cs:322)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
Model URN:
dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6bWFvbGlua3ppOHM3cnlvZWx4bjVndnR4bjcyZWc2N2l0dGp0a2MvMmZsb29yX0FyYy5pZmM=
[Update 23/4/2019]
I found that I can successfully load the same model with ForgeARKit-update-3-2017.1.2f1. I compare the Forge code in Unity. I think it has something to do with the service URL. The version 6 is fetching models from 'https://developer-api-beta.autodesk.io' while version 3 is fetching from 'https://developer-api.autodesk.io'. Meanwhile the shell script 'test-2legged' is uploading to the latter one ('https://developer-api.autodesk.io'). That is why it counldn'd find the resource. Question here is how can I upload model to the 'beta' ARKit? I tried modifying the URL in script 'test-2legged' but it doesn't work. Below screen-shot is the output of script 'test-2legged' when fetching from 'beta' ARkit. It seems model is uploaded successfully, but some parsing post-work failed. I guess the response format is also changed in the beta version. Is there a beta version of 'test-2legged' scripts (and other Scene Preparation scripts)?
Please comments, Thanks.
This is correct. My apologizes for this, I know we did not documented very well on the server changes.
This update6 assumes you are using the new server under beta right now. The scripts and update 3 are using the legacy server. Note that the 2 servers are not necessarily compatible and store the data in different places, so make sure to always use the same server in Unity as the one you used to prepare the scene. When we will switch everyone to the new server, we will transfer the data from the legacy server to the new server cloud storage.
The Update3 package will still be able to read scenes from the new server, as we make sure the old Unity code stays compatible.
Note as well you need to use SafeBase64 encoded string everywhere. I saw in your description that you are using base64 encoded (not safe). The new server will be more strict of parameters and format, so I encourage you to test your scripts/code on the beta server.
Last, I am working on a new Unity code update, and documentation which will be released next week. Make sure to use this version - it adds support for 3legged, automatic 2/3legged token refresh, and more. If you got scenes failing, please contact me directly and share your models and URN. I'll either test it on my development environment, or look into our log files for the reason to fail. My email address is my first name at autodesk.com
Thank you Cyrille for your help!! I am replying you here as it's easier to insert images.
I replaced the function 'xbase64encode()' with 'xbase64safeencode()', and now it works! However it seems for some model it still responds some error and in that case it cannot be loaded in Unity. (as the image below). I checked the script and I think all the encoding are using SafeBase64. Any clue of that? Or is that caused by my model?
BTW, the loading performance is greatly improved than the legacy version!! It looks almost the same as the web client. Huge Thanks for that!
Good to know that there is going to be an update next week. Yes I will test it and get back to you later.

How can I display an image from a file server with HTML

I have a website that displays a lot of messages and images, usually through normal HTML tags. We now have a file server where we would like it to be our one stop place to retrieve files and images.
I can create links that allow me to download files from the server but I can't find anyway of displaying the images on the web pages.
To clarify a bit more, our web page is running through a server we'll call SERVER1, and we used to just retreive our files from that server. Now we are still running the website through SERVER1 but want to display images from a different server named FILESERVER.
links like
http://SERVER1/imagedocs/image.jpg used to work but
http://FILESERVER/imagedocs/image.jpg doesn't work
while
file://FILESERVER/imagedocs/image.jpg does work but I believe this is because I have a local connection to the server and will not work if I apply it to the website.
Any clues on what I should be looking for as a solution.
the file:\\ means it's a local file opened by your browser.
There might be various reasons why you can't access stuff that are currently on your server. I will take as granted that the file is actually on your second server, and you havent made a typo ( you can still double check it though, double check the filepath too (( maybe it was ROOT/dir/image.jpg and now it's ROOT/image.jpg)) ). Do you know if your 2nd server is blocking connections perhaps ? Have you succesfully connected to it? i'd suggest you to ping your server adress to see if you got a response, if it does ping, we going to need more infos about the way your server have been set up.

JSON data from website

I'm currently using VB .NET 2010. I'm trying to read data from a JSON request from the website https://tradingpost-live.ncplatform.net/ws/search.json (Guild Wars 2 site).
The website requires you to be logged in via the forums. Even having this in my vb app via a webbrowser object, I am still receiving a 401 Unauthorized error. I assume some sort of cookie is needed???
The biggest issue I have is trying to run the larger search # https://tradingpost-live.ncplatform.net/ws/search.json?text=&levelmin=0&levelmax=80&count=0
This gives me the error "Unable to download search.json from tradingpost-live.ncplatform.net. Unable to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
By using Firefox, I can login and view each of these 2 sites without any issues. Any chance I can get a pointer in the right direction? So far I've installed JSON.NET but have no clue how to use it or if I should be doing something else...... almost midnight and my brain is fried!

Displaying remote URL

First I must explain I am a total newbie with regards to web design.
My question is as follows:
I would like to have a remote URL displayed through a different web server. The remote URL resides on an internal firewalled server and I would like to give public access to a single page by displaying it on a remote web server that has access to the firewalled page. I have tried iframes but they use the clients IP which results in the page failing to display. I have limited access to the server (CPanel) - please advise how this is possible? The remote URL will be requiring a login - not sure if this will have relevance on the solution.
What you can do is create a page which makes a request to the firewalled page using either CURL or HttpWebRequest or any compatible technology based on the platform you have chosen. It can then trim out the headers and other tags which are not required and render the html in a div, or it can just redirect the entire code in the response of your page.
This way, there will be no connection made from the client end, just your server will connect to your firewalled server and fetch the page from there and in turn give it back.
The only problem here is, forms - images and linked objects might not work properly, you might also have to parse them and replace the respective urls to point to your server which in turn proxyfy it.
Here is an example of it
https://proxify.net/