Non-Singleton Services in AngularJS

I’m not entirely sure what use case you are trying to satisfy. But it is possible to have a factory return instances of an object. You should be able to modify this to suit your needs. var ExampleApplication = angular.module(‘ExampleApplication’, []); ExampleApplication.factory(‘InstancedService’, function(){ function Instance(name, type){ this.name = name; this.type = type; } return { … Read more

catch on swipe to dismiss event

DeleteIntent: DeleteIntent is a PendingIntent object that can be associated with a notification and gets fired when the notification gets deleted, ether by : User specific action User Delete all the notifications. You can set the Pending Intent to a broadcast Receiver and then perform any action you want. Intent intent = new Intent(this, MyBroadcastReceiver.class); … Read more

Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel

Try with c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru When multiple versions of the .NET Framework are executing side-by-side on a single computer, the ASP.NET ISAPI version mapped to an ASP.NET application determines which version of the common language runtime (CLR) is used for the application. Above command will Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and … Read more

Install Windows Service with Recovery action to Restart

You can set the recovery options using sc. The following will set the service to restart after a failure: sc failure [servicename] reset= 0 actions= restart/60000 This can easily be called from C#: static void SetRecoveryOptions(string serviceName) { int exitCode; using (var process = new Process()) { var startInfo = process.StartInfo; startInfo.FileName = “sc”; startInfo.WindowStyle … Read more

Accessing UI thread handler from a service

This snippet of code constructs a Handler associated with the main (UI) thread: Handler handler = new Handler(Looper.getMainLooper()); You can then post stuff for execution in the main (UI) thread like so: handler.post(runnable_to_call_from_main_thread); If the handler itself is created from the main (UI) thread the argument can be omitted for brevity: Handler handler = new … Read more

Bind service to activity in Android

“If you start an android Service with startService(..) that Service will remain running until you explicitly invoke stopService(..). There are two reasons that a service can be run by the system. If someone calls Context.startService() then the system will retrieve the service (creating it and calling its onCreate() method if needed) and then call its … Read more

How can I configure a systemd service to restart periodically?

For systemd version >= 229, there is an option called RuntimeMaxSec, which terminates the service after it has been running for the given period of time. e.g. To restart every 7 days: [Service] Restart=always RuntimeMaxSec=7d To me this seems more elegant than abusing Type=notify and WatchdogSec. systemd provides a clean way to add and override … Read more

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