Google Chrome –allow-file-access-from-files disabled for Chrome Beta 8

Looking at the issues for this shows that the whole –allow-file-access-from-files thing was rushed. “Firefox does it..” “How can we do it?” some time passes “Here are the patches” “Passes! On trunk wonder what happens in the next dev release” “Ahhh it’s broken” “Use the command line option” “ok” “We shipped!” “WTF guys? You broke … Read more

PHP server on local machine?

PHP 5.4 and later have a built-in web server these days. You simply run the command from the terminal: cd path/to/your/app php -S 127.0.0.1:8000 Then in your browser go to http://127.0.0.1:8000 and boom, your system should be up and running. (There must be an index.php or index.html file for this to work.) You could also … Read more

Why are global variables always initialized to ‘0’, but not local variables? [duplicate]

Because that’s the way it is, according to the C Standard. The reason for that is efficiency: static variables are initialized at compile-time, since their address is known and fixed. Initializing them to 0 does not incur a runtime cost. automatic variables can have different addresses for different calls and would have to be initialized … Read more

Load HTML file into WebView

The easiest way would probably be to put your web resources into the assets folder then call: webView.loadUrl(“file:///android_asset/filename.html”); For Complete Communication between Java and Webview See This Update: The assets folder is usually the following folder: <project>/src/main/assets This can be changed in the asset folder configuration setting in your <app>.iml file as: <option name=”ASSETS_FOLDER_RELATIVE_PATH” value=”/src/main/assets” … Read more

WebView load website when online, load local file when offline

That sounds like a simple webview caching mechanism to me. The following should do what you are looking for: WebView webView = new WebView( context ); webView.getSettings().setAppCacheMaxSize( 5 * 1024 * 1024 ); // 5MB webView.getSettings().setAppCachePath( getApplicationContext().getCacheDir().getAbsolutePath() ); webView.getSettings().setAllowFileAccess( true ); webView.getSettings().setAppCacheEnabled( true ); webView.getSettings().setJavaScriptEnabled( true ); webView.getSettings().setCacheMode( WebSettings.LOAD_DEFAULT ); // load online by default … Read more

How to securely save username/password (local)?

If you are just going to verify/validate the entered user name and password, use the Rfc2898DerivedBytes class (also known as Password Based Key Derivation Function 2 or PBKDF2). This is more secure than using encryption like Triple DES or AES because there is no practical way to go from the result of RFC2898DerivedBytes back to … Read more