Symfony 2: Creating a service from a Repository

DEPRECATION WARNING: No more factory_service and factory_method. This is how you should do it since Symfony 2.6 (for Symfony 3.3+ check below): parameters: entity.my_entity: “AppBundle:MyEntity” services: my_entity_repository: class: AppBundle\Repository\MyEntityRepository factory: [“@doctrine”, getRepository] arguments: – %entity.my_entity% The new setFactory() method was introduced in Symfony 2.6. Refer to older versions for the syntax for factories prior to … Read more

Unable to start Service Intent

For anyone else coming across this thread I had this issue and was pulling my hair out. I had the service declaration OUTSIDE of the ‘< application>’ end tag DUH! RIGHT: <manifest xmlns:android=”http://schemas.android.com/apk/res/android” …> … <application android:icon=”@drawable/icon” android:label=”@string/app_name”> <activity …> … </activity> <service android:name=”.Service”/> <receiver android:name=”.Receiver”> <intent-filter> … </intent-filter> </receiver> </application> <uses-permission android:name=”…” /> WRONG … 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

What replaces WCF in .Net Core?

You can use gRPC for hosting web services inside .NET core application. Introduction gRPC is a high performance, open source RPC framework initially developed by Google. The framework is based on a client-server model of remote procedure calls. A client application can directly call methods on a server application as if it was a local … Read more

Delphi Windows Service Design

fast answers: 1&3) Yes. As a rule of thumb do not implement the OnExecute service event. Spawn your own thread from the OnStart service event. The thread can be terminated when you receive the OnStop service event. 2) you keep your thread alive like this (execute method): while not Terminated do begin // do something … Read more

conversion of a varchar data type to a datetime data type resulted in an out-of-range value

Ambiguous date formats are interpreted according to the language of the login. This works set dateformat mdy select CAST(’03/28/2011 18:03:40′ AS DATETIME) This doesn’t set dateformat dmy select CAST(’03/28/2011 18:03:40′ AS DATETIME) If you use parameterised queries with the correct datatype you avoid these issues. You can also use the unambiguous “unseparated” format yyyyMMdd hh:mm:ss