Why does $.getJSON silently fail?

you can use function name() { $.getJSON(“”, function(d) { alert(“success”); }).done(function(d) { alert(“done”); }).fail(function(d) { alert(“error”); }).always(function(d) { alert(“complete”); }); } If you want to see the cause of the error, use the full version function name() { $.getJSON(“”, function(d) { alert(“success”); }).fail( function(d, textStatus, error) { console.error(“getJSON failed, status: ” + textStatus + “, … Read more

Silent printing of a PDF in Python

I suggest you install GSView and GSPrint and shell out to gsprint.exe to print the pdf. p = subprocess.Popen([r”p:\ath\to\gsprint.exe”, “test.pdf”], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() print stdout print stderr I have used this in a industrial label printing solution, works great. When the gsprint.exe program exits (i.e. after the call to communicate), you can … Read more

How can the terminal output of executables run by Python functions be silenced in a general way?

For the ALSA errors in particular, you can use ALSA’s snd_lib_error_set_handler function as described for example in this question. For one of my projects, I created a module called mute_alsa, which looks like this: import ctypes ERROR_HANDLER_FUNC = ctypes.CFUNCTYPE(None, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p) def py_error_handler(filename, line, function, err, fmt): pass c_error_handler = ERROR_HANDLER_FUNC(py_error_handler) try: … Read more

How do I start playing audio when in silent mode & locked in iOS 6?

You need to make couple of changes in plist file. i.e. 1) Set Required background mode to App plays audio 2) set Application does not run in background to YES. NSError *setCategoryErr = nil; NSError *activationErr = nil; [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error:&setCategoryErr]; [[AVAudioSession sharedInstance] setActive:YES error:&activationErr]; Then, you need to write these much code … Read more

Install apps silently, with granted INSTALL_PACKAGES permission

Your first bet is to look into Android’s native PackageInstaller. I would recommend modifying that app the way you like, or just extract required functionality. Specifically, if you look into PackageInstallerActivity and its method onClickListener: public void onClick(View v) { if(v == mOk) { // Start subactivity to actually install the application Intent newIntent = … Read more