Android – How to download a file from a webserver

Using Async task call when you want to download file : new DownloadFileFromURL().execute(file_url); public class MainActivity extends Activity { // Progress Dialog private ProgressDialog pDialog; public static final int progress_bar_type = 0; // File url to download private static String file_url = “http://www.qwikisoft.com/demo/ashade/20001.kml”; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new DownloadFileFromURL().execute(file_url); } /** … Read more

Using variables in Nginx location rules

You can’t. Nginx doesn’t really support variables in config files, and its developers mock everyone who ask for this feature to be added: “[Variables] are rather costly compared to plain static configuration. [A] macro expansion and “include” directives should be used [with] e.g. sed + make or any other common template mechanism.” http://nginx.org/en/docs/faq/variables_in_config.html You should … Read more

Running Node.js in apache?

Hosting a nodejs site through apache can be organized with apache proxy module. It’s better to start nodejs server on localhost with default port 1337 Enable proxy with a command: sudo a2enmod proxy proxy_http Do not enable proxying with ProxyRequests until you have secured your server. Open proxy servers are dangerous both to your network … Read more

How can I create a simple index.html file which lists all files/directories?

There are enough valid reasons to explicitly disable automatic directory indexes in apache or other web servers. Or, for example, you might want to only include certain file types in the index. In such cases you might still want to have a statically generated index.html file for specific folders. tree tree is a minimalistic utility … Read more

Best way to parse a URL query string

Here is an example using python3 urllib.parse: from urllib.parse import urlparse, parse_qs URL=’https://someurl.com/with/query_string?i=main&mode=front&sid=12ab&enc=+Hello’ parsed_url = urlparse(URL) parse_qs(parsed_url.query) output: {‘i’: [‘main’], ‘enc’: [‘ Hello ‘], ‘mode’: [‘front’], ‘sid’: [’12ab’]} Note for python2: from urlparse import urlparse, parse_qs SEE: https://pythonhosted.org/six/#module-six.moves.urllib.parse

Apache Server (xampp) doesn’t run on Windows 10 (Port 80)

I had the same problem on windows 10, IIS/10.0 was using port 80 To solve that: find service “W3SVC” disable it, or set it to “manual” French name is: “Service de publication World Wide Web“ English name is: “World Wide Web Publishing Service“ german name is: “WWW-Publishingdienst” – thanks @fiffy Polish name is: “Usługa publikowania … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)