I want to create a custom DBAL driver which I will be using with the "driverClass" argument in the DBAL configuration. This works, but my driver needs additional classes to work. For instance, it needs a caching client and an HTTP client (it basically will fetch credentials remotely).
The issue is that inside DBAL's driver manager, a custom driver class is instantiated without arguments, so I cannot use a constructor to add additional services. I could create setters so I can use setter-injection, but I think this will cause problems when using the driver in Symfony applications for instance.
All the custom DBAL drivers I've researched are using tight coupling with HTTP clients and other services but I don't want this (I don't want to force users APCu caching for instance).
Is there a way to make this work?
Related
everyone! I am building a web application, i.e. a server-client application. For the interaction between the two, I have to define the URLs twice (hard-coded strings), both on the backend and the frontend, which makes future changes hard, because it would require changing the code in two places, rather than just one.
I am using Django and Angular and so I am looking for a way to specify the back end endpoints once, then ideally read them and use them for the Angular production build. Therefore changes to the endpoints will only require a new build, but no further changes.
Should these be defined in some .cfg file and be read by the back end on server startup and maybe somehow add them to the Angular's build process? Any suggestion would help because this redundancy comes in almost every webapp project and there has to be a more clever solution!
Thanks for the help in advance!
Here, it is the backend application that owns and defines url mappings to entities. It is possible that multiple clients can consume from the same API, like a web client, an Android client and an iOS client. In this setup, your backend is the point of truth for the url mappings, and client applications should be configured to use the url mappings defined in the backend application.
One possible way to do this is to serve defined urls in the backend on a path of the backend application, and have your client applications configure themselves using the data provided there. For example, if you use Django Rest Framework, by default, on the root path of the API ("/"), resources along with url mappings for the resources are served. You can use such a mechanism to configure your client applications on build time.
How many endpoints and how likely are you to alter them? Most likely you will always have to make more changes than just in 1 place as the reason behind changing an endpoint is normally you are trying to POST or GET new data structures. This would mean you will have to alter that request process anyway to handle the new data type or what was being posted.
Also, consider some of the publicly available api's out there - they don't give you an endpoint that serves a config file of available routes. When they make a change to their endpoints they usually create a versioned api so that consumers can upgrade in their own time.
In my opinion, unless you are planning a large scale web app, I wouldn't be too worried about trying to implement something like this.
Is there a way in C++ to set the Windows system proxy with authentication credentials so it would affect all running programs(browsers, etc...) immediatly but:
Not requiring restarting any browser
Not requiring browser-reauthentication
I am looking really for a system level pre-authenticated proxy.
Thank you for any help. Ask any questions if something is unclear.
Using: c++11, Windows 7
EDIT 1: I need to set this programmatically, so please do not suggest any manual actions.
EDIT 2: Partially acceptable is a way how to set proxy programmatically without pre-authentication but still keeping 1. requirement (Not requiring restarting any browser)
System-level proxy settings are located in registry under \Software\Microsoft\Windows\CurrentVersion\Internet Settings hive in HKLM for all users and HKCU hive for current user.
There is an official instruction how to change it via REG file, you does not need to write any code.
But the main problem is: any application may have its own proxy settings, where it 1) can prefer system level settings but allow to override it by user, 2) not using system settings at all.
In corporate environments this problem solves as:
Internet gateway not allowed directly access to external network any computer except proxy server (Microsoft ISA/Forefront Web Proxy)
Proxy settings in registry are forced to all computers via Group Policies
If user need to run application which can not use system-wide proxy settings - it need to install ISA Firewall Client which intercepts all traffic and authenticate it on the ISA proxy.
So when you use full Microsoft software stack - you still not need to write any code :-)
Moreover, ISA Firewall Client uses undocumented Windows features and it will be too hard to write something to replace it with your own "C++11" skills.
I am using Flex4 to connect to a SOAP web service. I'm generating the ActionScript classes using the Introspection Wizard in Flash Builder. That all works.
However, the web service is itself under development, so I need to periodically regenerate those AS classes to pick up the new methods or changed method signatures. The only way I've found to do that is to delete the existing classes, and re-run the wizard. HOWEVER, when I do that I also need to give the service a new name, or I see an error saying that the service already exists.
Is there any way to 'refresh' existing web service class definitions WITHOUT having to delete, come up with a new name, and re-create?
Thanks
Got it -- Show View -> Data/Services. You can refresh the service there and choose which methods to generate code for...
I am building a application that services users via a web front end, which I have chosen to use Django for. I also have to choose a framework/libraries to provide management of and abstracted access to a bunch of embedded systems that provide information the web user gets to see in one form or another.
I like the idea of sticking with a restful approach to access the backend application which provides the hardware generated resources. Does it make sense to use Django for the front end and CherryPy for the backend? Or should I just use Django for both and ignore the stuff I don't need in django for the backend.
I guess another way to ask, is what do I gain by using CherryPy as the backend that out ways having to know two sets of libraries/frameworks.
I don't see any real benefit, only added complexity in the long run. If you are using Django's ORM, you'll want to build the REST interface around that anyways. For building REST interfaces with Django I like using django-tastypie which makes it easy to build RESTful APIs supporting authentication/authorization, validation, various types of serialization, throttling, caching, etc. I also rather like django-piston, which is also quite popular.
I have got a web application which is speparated in a GUI (JSF 2.0, Orchestra, Spring) and service (Spring, JPA, Hibernate,...) project. Due to network issues between the web server and the database server, I neet to split the application completely, between the layers and deploy them on two different tomcats, for the service part close to the database server. I have generated allready a webservice and a webservice-client with the Eclipse WTP CXF Plugin.
My Problem is: For the client it generates a copy of the domain model classes, so I can't use them directly in my gui project and would need to introduce an conversion layer, between the web service client and the gui layer. Wich is cumbersome and error prone.
Is there a possibility to generate the web service client (out of the existing web service module and the wsdl) using the shared domain model (model classes are in an separate project, wich both - service and gui - projects depend on)?
desperatly looking for a solution, as the deployment deadline is close...
To generate a copy of the domain model classes (DTOs) is a good practice when you have two physical layers : Your Hibernate POJOs need to be deproxyfied before being sent to an other physical layer. Maybe you could use Dozer to do it, to avoid to spend too much time doing it.
Maybe you should use RMI instead of Web Services if you need performances.
If you're absolutely determined to use your domain objects in the presentation layer, you should look about Gilead (formerly known as Hibernate4GWT).
Pure DTOs, DTOs with Dozer, and Gilead use are described in details here :
http://code.google.com/intl/fr/webtoolkit/articles/using_gwt_with_hibernate.html