Access PHP var from external javascript file

You don’t really access it, you insert it into the javascript code when you serve the page. However if your other javascript isn’t from an external source you can do something like: <?php $color = “Red”; ?> <script type=”text/javascript”>var color = “<?= $color ?>”;</script> <script type=”text/javascript” src=”https://stackoverflow.com/questions/2928827/file.js”></script> and then in the file.js use color like … Read more

Load external JS from bookmarklet?

2015 Update Content security policy will prevent this from working in many sites now. For example, the code below won’t work on Facebook. 2008 answer Use a bookmarklet that creates a script tag which includes your external JS. As a sample: javascript:(function(){document.body.appendChild(document.createElement(‘script’)).src=”https://stackoverflow.com/questions/106425/** your external file URL here **”;})();

External JavaScript file is not getting added when running on Flask

Serve the map.js file as a static resource: move the file to a static/ subdirectory of your package generate a static URL for it in a Jinja2 template like so: <script type=”text/javascript” src=”https://stackoverflow.com/questions/14711552/{{ url_for(“static’, filename=”map.js”) }}”></script> The filename parameter takes a relative path; you can use subdirectories was needed.

Android saving file to external storage

Use this function to save your bitmap in SD card private void SaveImage(Bitmap finalBitmap) { String root = Environment.getExternalStorageDirectory().toString(); File myDir = new File(root + “/saved_images”); if (!myDir.exists()) { myDir.mkdirs(); } Random generator = new Random(); int n = 10000; n = generator.nextInt(n); String fname = “Image-“+ n +”.jpg”; File file = new File (myDir, … Read more

Log4Net config in external file does not work

Do you have the following attribute in your AssemblyInfo.cs file: [assembly: log4net.Config.XmlConfigurator(ConfigFile = “Log4Net.config”, Watch = true)] and code like this at the start of each class that requires logging functionality: private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); I have a blog post containing this and other info here.

Piping buffer to external command in Vim

You can use :w !cmd to write the current buffer to the stdin of an external command. From :help :w_c: :w_c :write_c :[range]w[rite] [++opt] !{cmd} Execute {cmd} with [range] lines as standard input (note the space in front of the ‘!’). {cmd} is executed like with “:!{cmd}”, any ‘!’ is replaced with the previous command … Read more

Find location of a removable SD card

Environment.getExternalStorageState() returns path to internal SD mount point like “/mnt/sdcard” No, Environment.getExternalStorageDirectory() refers to whatever the device manufacturer considered to be “external storage”. On some devices, this is removable media, like an SD card. On some devices, this is a portion of on-device flash. Here, “external storage” means “the stuff accessible via USB Mass Storage … Read more

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