w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using mutiple datasources in myBatis and Spring
Please check http://mybatis.github.io/spring/factorybean.html for more details on configuring your sqlSessionFactory1

Categories : Spring

Spring Social & JPA - Having two datasources pointing to the same database
Downside of this solution is that you need to reduce maximum capacity of connection pool. Example: imagine that you have a connection pool with max 30 connections in it. Now you want to add another datasource for Spring Social. I suppose that each your user will use 2 datasources simultaneously. So you need 2 connection pools with max 15 connections in each. Now it will be much easier to hit the limit.

Categories : Java

Dummy questions about setting up git on amazon cloud ec2
look here for more information on setting up git on amazon ec2 to allow developers to use you git, you just need to give them the git server url. Direct quote from the site i'm linking to. "First and foremost, you need to add your EC2 identity to the ssh authentication agent. This prevents problems with git later, namely getting the error “Permission denied (publickey).” when trying to do a git push to the EC2 repository. ssh-add path/to/privateEC2key.pem Now you can go ahead and create the git repository on the EC2 instance. ssh username@hostname.com mkdir the_project.git cd the_project.git git init --bare So not much going on here, all we do is create an empty repository and then leave. Now, on the local machine, you do something like the following: cd the_project git

Categories : Linux

Setting up an PHP+MySQL website on Google Cloud
For Google App Engine: PHP runtime is currently in limited preview. (so not everything is working as expected) And instead of using MySQL, you have to use CloudSQL. For details please see here: https://developers.google.com/appengine/docs/php/cloud-sql/ You don't need any Linux experience for using GAE, but you will need to read through the documentations. Javascript is client side program so it doesn't matter with the server.

Categories : Google App Engine

Setting up Server Side for Google Cloud Messaging
If you have used PHP you should be familiar with xampp or similar software. If not, all you have to do is download and install it, start the services and on your browser go to: http://localhost/xampp to test if it's properly installed. If you can see the Xampp page you can start running scripts php from xampp/htdocs and run them like this: http://localhost/yourscript.php Try a simple hello world: <?php echo 'hello world'; ?> After that you should be ready to start following this tutorial or any tutorial in google just typing gcm php tutorial I found that php is the most simple way for me to configure the server side for GCM, hope you find it useful...

Categories : Android

Setting up CORS Access-Control-Allow-Origin on Rackspace Cloud Files?
That's not really what CORS is for. Cross-origin resource sharing (CORS) is a mechanism that allows Javascript on a web page to make XMLHttpRequests to another domain, not the domain the Javascript originated from, see CORS. It has nothing to do with making an object or container public/private. On Rackspace, CORS works according to this doc.

Categories : Apache

Making the normals of a point cloud point outward by duplicating the cloud ,enlarging it and centering it over the original cloud
First: Have you looked at your output, i.e. are the bunnies really overlaid how you want them to? Second: You're missing the part, where you determine the normals. Are you looking for nearest points and thus the intersections are a problem? A better solution might be to match the exact points in both point clouds and determine the normals by those.

Categories : Python

XML-free Spring not setting up
The solution involved Eclipse not deploying the assembly correctly. Goto properties on the project -> Deployment Assembly -> Added "/src/main/java" deployed to "WEB-INF/classes" and then it picked up my Initializer. Not sure why this wasn't there to begin with.

Categories : Spring

Binding to 2 Datasources
I would recommend to create a ViewModel as a layer between your model and the view. In the ViewModel you can arrange the data to fit to the used controls without changing your model. So the ViewModel could for example split the tokenString of the DataEntity into a list of tokens. Just Google for MVVM (Model-View-ViewModel) for examples and furter explanations or look here on SO (like MVVM: Tutorial from start to finish?).

Categories : Wpf

Repeater with 2 datasources
The message class has MessageID, UserID and Content as members. You need to select the Message joined with the User and project only the columns which you want to display. For instance you can define a class named DisplayableMessage, for instance which will have members, such as MessageID, UserName and Content. You can define a method for the class, let's name it GetDisplayableMessage which will initialize a List of DisplayableMessage based on Message and User data. And then you can associate this method to the DataSource of the Repeater.

Categories : C#

Get Datasources programmatically
If your datasources are configured with JNDI then you can list the context and can get all the names (more from here) with Context.list() method and from those name you can find all the datasources the Context.list() returns an enumeration of NameClassPair. Each NameClassPair consists of the object's name and its class name. So just iterate it and check the class name for java.sql.DataSource and then get the object name to retrieve it.

Categories : Java

setting up spring security with mongoDb
You may have an incorrect version of spring-core pulled in via transitive dependencies. Try forcing a concrete version by adding: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.2.0.RELEASE</version> </dependency> And you don't need spring-orm for MongoDB. ORM stands for Object-Relational Mapping, and MongoDB is not relational. Also do use JUnit 4!

Categories : Java

Setting up Hibernate+C3P0 in Spring
C3P0 is used to support connection pooling. See http://www.mchange.com/projects/c3p0/ for further information on C3P0 and https://community.jboss.org/wiki/HowToConfigureTheC3P0ConnectionPool for information on configuring C3P0 with Hibernate.

Categories : Spring

setting annotation attributes in spring xml
Yeah -- that's not ever going to work. @LogExecTime(logTime=@Value("#{ConfigureAnnotation.doLogging}")) will never even compile. Annotations are not executable code, they're just markers -- extra bit of information that are inserted into the class file whole sale. You could either put this: @Value("#{ConfigureAnnotation.doLogging}") boolean logTime = true; As a real field on a spring managed bean somewhere, or have change your annotation to be like: @Component @Retention(RetentionPolicy.RUNTIME) public @interface LogExecTime { public String logTime() default "true"; } and have whatever is processing that annotation at run time also accept a spring EL expression and resolve it appropriately, and your component would look like this: @LogExecTime(logTime = "#{ConfigureAnnota

Categories : Java

Cakephp model with several datasources
You can change the data source by calling Model::setDatasSource(). You can change the model the paginator uses by: $this->Paginator->paginate($ModelInstance); Or $this->Paginator->paginate('ModelName'); You might want to read that page. Don't use Controller::paginate any more but instead $this->Paginator->settings. For settings per model use $this->Paginator->settings['ModelName'] = array(/*...*/);

Categories : PHP

communicating between two dataSources on same XPage
An easy way to access the data source from another custom control is using a scope variable. Set in first custom control a view scope variable to data source mainDoc in beforePageLoad event: <xp:this.beforePageLoad> <![CDATA[#{javascript:viewScope.sourceMainDoc = mainDoc}]]> </xp:this.beforePageLoad> Then you can work in second custom control with this view scope and e.g. save the mainDoc: <xp:this.action> <![CDATA[#{javascript:viewScope.sourceMainDoc.save()}]]> </xp:this.action> Alternative Use Sven Hasselbach's way to get data source from custom control. You'll get an object of instance com.ibm.xsp.model.domino.DominoDocumentData. If you want to use same methods like for normal data source Domino Document objects (= NotesXspDocument) yo

Categories : Database

Spring MVC form setting fields as null
Use Firebug or similar tool to see if the form field values are correctly included in the request, and the request is sent to correct URI. Log (or debug) and check the user object content right after receiving the request, in doSave(). Log (or debug) and check the user object content in userRepository.save() to make sure all values are available, prior to persisting it. Following could be the actual reason, but first checking above would iron out other possiblities Remove enctype="multipart/form-data" in form definition as this form does not intend to send binary data. Check following for more info on that: What does enctype='multipart/form-data' mean? Form content types in HTML 4 spec Multipart form data encoding in HTML 5 spec

Categories : Spring

Spring: Injecting Properties using @Value and setting a default
Before all: defaultDbProps location is the same of dbProps one. You are accessing properties value in the wrong way (with spEL); use ${} tag in this manner @Value('${my.property}'), but to have ${} available you need a PropertyPlaceholderConfigurer: <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="propertiesArray"> <list> <ref bean="defaultDbProps"/> <ref bean="dbProps"/> </list> </property> </bean> with this bean defaultDbProps are loaded first, then dbProps overrides properties with the same name

Categories : Spring

Spring: Setting a property annotated with @Resource
@Resource is not meant for property injection. For this to work: <bean id="someBean" class="foo.SomeBean"> <property name="someProp" value="bar" /> </bean> you need to implement a setter method public void setSomeBean(String value) { someValue = value; } @Resource could be used if you want to inject a different bean from your context. @Resource(name="someBean") SomeBean someBean

Categories : Spring

Can't access jsp anymore after setting up Spring security
You could try changing spring-security.xml by adding the line <intercept-url pattern="/views/**" access="hasRole('ROLE_USER')"/> so that the /autoPA/WEB-INF/views directory will be available to a user with ROLE_USER role. Hope that helps

Categories : Java

Spring MVC form:radiobuttons tag not setting value attribute
I solved it using multiple radiobutton tags instead of a single radiobuttons tag. Here is the code of the JSP: <c:forEach var="item" items="${store_location_types}"> <form:radiobutton path="StoreLocationType" value="${item.value}"/>${item.displayName} </c:forEach> I used plain objects from database, so in my case value was the Id and the displayed string was the description. But this should work with enum too.

Categories : Java

Do all sql DataSources load in asp.net Multiview control?
Yes, all those datasources will be executed hence it's not a good approach. MultiView renders only active view, but all controls in all views are going through the page life cycle therefore will be executed.

Categories : Asp Net

grails app war pointing to two different datasources(oracle and SQL)
I would configure the DataSource for different environments. I understand you want the application instance to access only one database at a time. So in one war, the app will connect do SQL Server, and in the other instance war, the app will connect to Oracle. If this is the correct understanding, I would do the following in the DataSource.groovy file: environments { sqlserver { dataSource { dbCreate = "none" url = "jdbc:mysql://localhost:3306/mydb" driverClassName = "com.mysql.jdbc.Driver" dialect = "org.hibernate.dialect.MySQL5InnoDBDialect" username = "dbowner" password = "xxxxx" logSql = false pooled = true properties { maxActive = 30 // -1 para sem

Categories : Grails

Managing WildFly deployable datasources
There are no plans to add support for that in near future. Best to move datasources configuration to standalone.xml to get management capabilities. Deployable data sources are primary meant for development process. see WildFly documentation on how to configure datasources that can be manageable via admin console / CLI / rest

Categories : Database

Setting a properties file in Spring Batch via a JobParameter
This is not the right way to proceed (it is impossible do what you are trying to do). You have to think that jobParameters is available only when a job is running and only for its composing steps marked with scope="step" (and not <context:property-placeholder> nor <util:properties> has a step attribute). A way for solving the problem is to load properties file in job's execution context before first step is running with a listener: public class PropertyLoaderJobExecutionListener extends StepExecutionListenerSupport { Properties countryProperties; public void setCountryProperties(Properties pfb) { this.countryProperties = pfb; } @Override public void beforeStep(StepExecution stepExecution) { super.beforeStep(stepExecution); // Store property file content

Categories : Java

Jpa + Spring - automatically setting transient field value after read from DB
You got entity which has transient field and the value is always taken from service using DI? What is the purpose of the field? It's used for some calculation within any entity method? Such calculation should probably use service's method to obtain the value. As value from any service is used, I'm not sure whether such calculation (method) belong into entity. Note that entity and service has completely different lifecycle. The value is changing in the time so it does not make the sense to supply the value in entity's factory at the beginning of it's life?

Categories : Spring

Grails GORM domain association across two datasources
As @dmahapatro points out in his comment, this is similar to the 1-element case, and creating your own methods to manage the relationship is the way to go. This is also related to a talk I did a while back about performance issues with mapped collections, so you can kill two birds with one stone: http://www.infoq.com/presentations/GORM-Performance If you don't need the collection, i.e. if you only use it to add new instances of the child object, then this will work because the get call for the DomainClassB instance will use its datasource: class DomainClassA { Long domainClassBId private DomainClassB dcB DomainClassB getDomainClassB() { if (!dcB && domainClassBId) { dcB = DomainClassB.get(domainClassBId) } dcB } void setDomainClassB(Dom

Categories : Grails

(Spring + JSP + jQuery-AJAX + JSON ) setting environment for UTF-8 issue?
I would try some debugging in the browser. Use some developer tools in your browser (Developer Tools in Chrome, Firebug extension for Firefox or any other such tool in any other browser) and try to check HTTP response you are getting for your ajax - check if HTTP headers are correctly set (utf8 encoding, etc.) and maybe if ypur special characters are displayed correctly there - so you can see, if you are getting correct answer from the server. BTW - I dont see any error in code you posted, everything looks good. Just double check, that page on that you are displaying response with ajax, has utf8 encoding set...

Categories : Java

Having same method calls and setting a attribute in all (or most of my) controllers in Java Spring MVC
If I got your Question properly, you need some list object whose values you need to get displayed in all view pages at left/right side. If that list values(table from where list is getting populated) is not changing frequently then you can hit Query once and get your list ready only once, then you can set that list as Session Variable, So that you can fetch it directly at View Layer. Based on you correct requirement, you can go some similar requirement if this doesn't work.

Categories : Java

Spring mvc:view-controller and component-scan setting priority
Having the view resolver in front of the controllers sounds like a terrible idea (if it's able to be done), particularly since the UrlBasedViewResolver (or something) and subclasses throw exceptions if they don't find a match rather than passing through the chain. If you only want the controller to step in when the path variable is an integer you should use the pattern matching option for the RequestMapping, something like /e{number:d+} should steer you in the right direction for a Google search.

Categories : Java

what is the significance of auth attribute of datasources defined in tomcat
Go through the doc , it explains it : Specify whether the web Application code signs on to the corresponding resource manager programmatically, or whether the Container will sign on to the resource manager on behalf of the application. The value of this attribute must be Application or Container. This attribute is required if the web application will use a element in the web application deployment descriptor, but is optional if the application uses a instead.

Categories : Java

Disable automatic generation of datasources file when updating service references
I have encountered the same problem , After I did not tried to reach a settlement , Add servicereference - advanced -add web reference and write url than dizayn client code.example MobilServiceReference.MobileService service = new MobilServiceReference.MobileService(); secondLoginResponse = service.SecondLogin(password, sendedPassword, true, true, mobileTransactionHeader); Regards,

Categories : Visual Studio 2012

Exception thrown when connecting Neo4j+HA and Spring Data- "Missing Mandatory Setting ha.initial_hosts"
The config of bean haDatabase is incomplete. Neo4j 1.9.x does not use ha.coordindator, use ha.initial_hosts instead. ha.coordinator was used up to 1.8.x.

Categories : Neo4j

Is google cloud storage object versioning compatible with appengine cloud storage client library?
The AppEngine GCS Client Library doesn't support versioning at this time. If you enable versioning on a bucket through other channels, the GCS Client Library will keep working fine, but in order to access or delete older generations of objects, you'll need to use either the XML API or the JSON API (as opposed to the appengine-specific API). There is a Python client for the JSON API that works fine from within appengine, but you'll lose a few of appengine's niceties by using it. See https://developers.google.com/appengine/docs/python/googlecloudstorageclient/#gcs_rest_api for more details. Here's a bit of info on how to use versioning from the XML and JSON APIs: https://developers.google.com/storage/docs/generations-preconditions

Categories : Python

Editing an application contains cloud messaging developed with c2dm will make any issue with cloud messaging?
For the time being, C2DM still works and upgrading your app shouldn't affect it, though you are encouraged to migrate to GCM. Android Cloud to Device Messaging (C2DM) is deprecated. The C2DM service will continue to be maintained in the short term, but C2DM will accept no new users, and it will grant no new quotas. C2DM developers are strongly encouraged to move to Google Cloud Messaging (GCM). GCM is the next generation of C2DM.

Categories : Android

How can I delete a google cloud project from google cloud console?
The documenation you are referring to uses this other console https://code.google.com/apis/console/ On the left you will find the dropdown menu.

Categories : Google App Engine

Is it possible to run a spring webmvc webapp with spring security in one spring container?
Short answer Remove the /WEB-INF/myapp-servlet.xml from the contextConfigLocation context param. Long Answer The ContextLoaderListener creates a root application context based on the configuration files defined in the contextConfigLocation and loads it into the ServletContext before any Servlet is initialized. The DispatcherServlet at the same time, will create a child application context with the specified configuration. You are not explicitly specifying any bean definition file, so by convention it will take /WEB-INF/appName-servlet.xml (/WEB-INF/myapp-servlet.xml in your case, which by chance exists). It happens that both your root application context and your child application context will have some common beans (duplicates, because they load the same configuration file). You hav

Categories : Java

I am new to Spring and I'm using Spring 4.0.0M2, in this i didnt find Spring.jar file
If you are creating a Maven Project, then use this repository and maven coordinates. It will download all the dependencies for you. Repository - http://repo.springsource.org/milestone/ Maven co-ordinates <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.0.0.M2</version> </dependecy>

Categories : Java

Linux/Unix - Setting default file/folder permissions using ACL, executable permission not setting?
It's not setting the execute bit because files are only created with execute permission if the application explicitly requests it. Since it makes no sense to make an .html file executable, whatever program created it did not request execute permission to be added, so it has no execute permission. Consequently, execute permission from the default ACL effectively only applies to directories, not to files. As for why the default group is not set to ftp, this is more subtle. The default ACL is just that -- an ACL. It's not a default group ownership. As such it shows up not in ls but in getfacl: # mkdir public # setfacl -R -m u::rwx,g:ftp:rwx,d:g:ftp:rwx,o::rx public/ # getfacl public # file: public # owner: root # group: root user::rwx group::r-x group:ftp:rwx mask::rwx other::r-x defa

Categories : Linux

Setting value to a input field using Jquery val not working.I have commented out code setting value in edit() function
check this fiddle js fiddle here is the code that i have modified. function edit(id){ $("#firstName").val(data[id].firstName); $("#lastName").val(data[id].lastName); $("#city").val(data[id].city); $("#state").val(data[id].state); $("#pin").val(data[id].pin); }

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.