How to trigger a php file with Kotlin? - http

I have to put into a mysql database on a remote server an int 1 and 0, depends on an external request.
I wrote two php files and put them on the remote server.
on.php
off.php
I can trigger them through my web browser like: "https//www.anysite.com/temp/on.php"
I have to do the same on my android app what I'm writing in Android Studio.
I tried many possible options to achieve my need but without any success.
In my Android app I have two buttons, one is the "On" the second is the "Off" button.
Depends on which button is pressed that php file should be loaded/triggered.
I don't have to pull any data out.
Practically I need help to make a working http request what in my case looks like a horrible nightmare to achieve.
Any help or suggestions or example I would really appreciate.
Thank you.
I tried various libraries but all of them are failed.
Most of time I focused to use Retrofit and Fuel libraries.

Related

Possibility of getting offline shinyApp without Publish Button, csv Data and seeing R code?

Hi guys i have made a shinyApp for a client using R.
The client for whom I’m working is asking for a shinyapp that works offline preferably in the form of an application or shiny window (as the online link of shinyapp.io will put load on the server). He wants to get the shiny output without seeing the R code.
He will later handover the shinyApp to his employees (>200) and they will mostly use the offline shinyApp on their desktop (in shiny window). Furthermore the data is very confidential so the client doesn't want his employees to either get csv data or publish the app online or see R code. Because every time they would run the app, they require csv data or codes to generate output.
That's why he doesn’t want a publish button anywhere in the app so that his employees doesn’t publish the app online.
Is there any way to do so? Any suggestions would be much appreciated
Method 1
I feel this is the best way to do it. This will give you an exe setup to install on your clients' server If you find it complicated you can try the below method, but my first preference would be this one.
Method 2
The process of making your standalone app is best explained here.
You can also use this site. If you feel the first is a little ambiguous
It is very much possible, and I do it often. If you have any doubts, you can ask me. This will not show the code to your client, it will be like any other desktop/server app, although the code can be seen if the app is probed, unlike the first method.
You can put the packaged app in a server which serves the local IPs.
I think you can do it without any hassle. Just follow the instructions line by line.
Regards/Revanth Nemani

Printing messages on the OSGi console

I'm implementing a very light weight (embedded) OSGi framework which runs on a target piece of hardware. To attach a console I'm using org.apache.felix.gogo.shell and org.apache.felix.shell.remote.
To date, I've logged all custom messages using System.out.println which has worked fine, but now that I'm using the remote console I require something that will allow me to 'print' my messages to the OSGi console (and hopefully appear both on the target's console as well as the telnet console provided by felix.shell.remote).
I'm guessing there must be a way to get a handle to an OutputStream (or similar) to do this; My question is how? It seems that most people redirect their stdout etc. to solve problems like this.
I'm using declarative services, so I was hoping to be able to setup a component which attaches a referenced service (not important, but would make it nice and neat).
Any help is greatly appreciated.
The best way is to use logging for custom messages using the OSGi Log Service. That way you can get recent logs from the LogReader service from inside your shell or webconsole. If you insist on using popular frameworks like log4j etc. then you can get a bridge with Pax logging.
Alternatively, redirecting the output to a file in a known location works. You can then make a command in gogo that views that file or provide a tail function that continuously displays the new parts of the file.

How to handle offline mode for Google visualisation in GWT

I have a GWT application that uses many Google maps and charts. I want to have an offline mode where the user have the application installed on his the computer and without using the Google apps, he can continue using the other features.
For now the maps in the application throught a nullpointer error because they cannot initialize. I thought about checking the internet connection in EntryPoint and change the behaviour accordingly, but I am hoping for a simpler solution. Any thought ?
per https://developers.google.com/chart/interactive/faq#offline
You cannot do that:
Can I use charts offline?
No; your computer must have live access to http://www.google.com/jsapi in order to use charts. This is because the visualization libraries that your page requires are loaded dynamically before you use them. The code for loading the appropriate library is part of the included jsapi script, and is called when you invoke the google.load() method. Our terms of service do not allow you to download the google.load or google.visualization code to use offline.
Can I download and host the chart code locally, or on an intranet?
Sorry; our terms of service do not allow you to download and save or host the google.load or google.visualization code
Update
I thinks the terms and conditions are changed now. As you can save and download JsAPI, ServiceBase to use charts offline.
But you still can't make ajax calls :Ajax
Hope it will be available soon, cheers!

In a .Net web site, what are my options for sending email alerts when folder contents change?

I don't know much about the .Net environment, so my first idea was to just write a console app that scans the folder for new content, and then emails alerts out. Then put the .exe as a scheduled task on the server, executing every few minutes. This seems pretty archaic to me though. Is there a more elegant way to do this for my website?
No matter what type of application you choose the way to get notifications about folder changes in .NET is through the FileSystemWatcher class. A good approach would be to create a Windows Service which will run in background and listen for notifications.
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
You can use the FileSystemWatcher. Create a Windows Service that constantly runs, and attach an Event to the Watcher to send out emails.
Note that this reports every change, sometimes multiple ones (e.g., moving a file is a delete and create I think), so you may want to limit the number of emails you sent. Experiment a bit before sending hundreds of emails or so - been there, done that :)

Flex Write File

I checked in the API, that writing a file is only in Flex Air.
Despite of that, is there still a way in Flex to write a file on the server or on the client machine ?
More concretely, it's because I have a String and I will decode it by mx.utils.Base64Decoder
to a doc. And I need to open it by Word directly on the client side, or write it on the server and return the link to the client for downloading.
Thanks
I'm doing something similar - I have built a custom grid in Flex that contains an additional button on it that allows the user to open the data up in Excel. I've done this by writing a function in PHP on the server which my Flex speaks to. This creates the CSV file on the server and the function passes the link back to the client, which in turn offers the user the chance to open the data up in Excel.
I'm using the Zend technologies to accomplish this - I recommend you take a look; they're extremely good. I used to use Flex Data Services and Java do do this but just recently switched to PHP because development time is cut down drastically as a result.
Hope this helps.
Jamie.
AIR applications run on the users' desktops. They allow you to write to the users' desktops. Nothing stops Flex/AIR applications from communicating to the server, write some files there (using a suitable backend technology) and return a link back to the user.

Resources