w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Spring LdapTemplate search by Object attribute
I think you should be able to query it if you replace "(objectClass=apiRole)" with "(RoleCode=1)". Or you could build a filter. If you're using Spring LDAP 1.3.2: AndFilter filter = new AndFilter(); filter.and(new EqualsFilter('RoleCode', '1')); Then you would replace "(objectClass=apiRole)" with filter.encode()

Categories : Java

Spring MVC REST: Method to Search Active Directory using LdapTemplate, LdapContextSource and SpringSecurityAuthenticationSource
http://forum.spring.io/forum/spring-projects/data/ldap/130283-search-active-directory-with-ldaptemplate-ldapcontextsource-sp-sec-auth-sou-rce dont use the DefaultValuesAuthenticationSourceDecorator, if you want to use only default user and password. The DefaultValuesAuthenticationSourceDecorator try to use the spring security user in session to perform the actions in LdapContext: Solution: <beans:bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate"> <beans:constructor-arg ref="contextSource" /> <beans:property name="ignorePartialResultException" value="true" /> </beans:bean> <beans:bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource"> <beans:property name="url" value="${ldap.url}" />

Categories : Spring

generate uidNumber for Ldap posixAccount with LdapTemplate
If your server supports the modify-increment request control, an LDAP client could use that to increment an integer in one atomic operation. See also: LDAP: Modify-Increment Extension.

Categories : Java

How to store group member in string Array
If you just want to store an array of Strings without knowing the number of Strings to store use an ArrayList. //create the arraylist ArrayList<String> memberNames = new ArrayList<String>(); // add the memeber name to the array memberNames.add(attributes.get("member"));

Categories : Java

Can't add member to a group in Azure Active Directory through Graph API
You probably need to give proper access in the Azure portal and configure this in your project for a WEB APPLICATION AND/OR WEB API. This changes were made recently in the portal (before we had to do a lot of things using PowerShell). We made an article explaining more or less how to configure everything: http://www.clouddevx.com/en-us/Blog/ArtMID/836/ArticleID/2 EDIT: just to give some more explanation what I think is that you probably have to set the service with informations about the Client ID and password obtained in the Azure portal: var tenantName = "emyode.com"; string clientId = "clientId obtained in Azure portal"; string password = "security key obtained in Azure portal"; var token = DirectoryDataServiceAuthorizationHelper.GetAuthorizationToken(tenantName, clientId, pass

Categories : Azure

Skype4Py: Change the role of a group chat member
It took 2 extra steps to get to where I wanted to be: I was using chat.Members when I needed chat.MemberObjects The bot had to be the CREATOR for my little trio of testing accounts. It may have something to do with who adds which user. Previously, my bot was a MASTER and user1 was CREATOR. I don't know how a user's AddedBy property affects a user, but it does something. Now that my bot is CREATOR, I can affect other users' roles.

Categories : Python

Spring 3 MVC capability for JSTL jsp option group label
Watch you case: servicemodule != serviceModule. The <c:foreEach> loop isn't correct either: it uses itemGroup both for var and varStatus, and itemGroup is never used inside the loop. Instead, serviceModule is used, but is not defined anywhere. And I have a hard time understanding your code, one of the reasons being that you use the same name for very different things and don't pluralize attributes of type List. private ServiceModule servicemodule; ... Map<String,List<String>> serviceModule ... private List<String> servicemodule; ... <form:select multiple="single" path="serviceModule" id="serviceModule"> ... <c:forEach var="itemGroup" items="${servicesModule}" varStatus="itemGroup"> No wonder you lost yourself.

Categories : Java

Spring batch writer: add a terminator record after a group of records
You're right, footerCallback of FlatFileItemWriter will always be called even if there's an error in writing the records. You can pass the "group" variable to the footer callback (e.g., through ItemStream) and the callback can refer to the latest "group" and write if it's not null. So you don't have to care/define the last group before you start writing. Alternative: Following your current setup, I'm thinking if it's possible for you to get the number of records you are expecting to read. Using that count, inform your writer so it knows when to write the last termination record.

Categories : Spring

Spring MVC Form binding a group of two or more fields into a list of objects
This may not be the best technique for this, but here is how I would implement a solution for your question. Create a field for each of the phone fields in the PhoneForm. This will be useful, if for nothing else, to set the value on your page. Create a method in the PhoneForm class (perhaps called getMobilePhoneList()) that creates a list of Phone objects for the mobile phones. Create a method in the PhoneForm class that creates a list of Phone objects for the personal phones. Create a method in the PhoneForm class that creates a list of Phone objects for the work phones. Use the PhoneForm getters to populate fields on the page and during validation. Use the getxxxPhoneList() methods in java when you need them.

Categories : Java

Is there any form to group a conditions in a query method with spring-data jpa?
You can always provide a custom query: @Query("select t from Transaction t where t.type = ?1 and (t.status = ?2 or t.value = ?3)") public List<Transaction> findByTypeAndStatusOrValue(int type, int status, int value);

Categories : Java

Spring Data MongoDB - Aggregation Framework - invalid reference in group Operation
The problem is not PDch or pd.PDch. For some reason the code is not using the Aggregation.DEFAULT_CONTEXT to get the field reference. This is happens when ever there is more than one field. Code works correctly if you only have one group field.

Categories : Mongodb

How Does Getting the Address of a Class Member Through a Scope Resolution Operator Work When Using a Pointer-to-Member?
When you declare a pointer to member data, it isn't bounded to any particular instance. If you want to know the address of a data member for a given instance you need to take the address of the result after doing .* or ->*. For instance: #include <stdio.h> struct A { int n; }; int main() { A a = {42}; A aa = {55}; int A::*ptm = &A::n; printf("a.*ptm: %p ", (void *)&(a.*ptm)); printf("aa.*ptm: %p ", (void *)&(aa.*ptm)); } prints as one possible output: a.*ptm: 0xbfbe268c aa.*ptm: 0xbfbe2688

Categories : C++

Strange behavior with volatile write on class member vs struct member
The time difference is most likely a consequence of the var volatileLong = new VolatileLongClass(); within the loop; that statement causes the compiler to--once--allocate space to hold a VolatileLongClass reference, and then on each pass through the loop create a new object and store a reference into that location. By contrast, the statement var volatileLong = new VolatileLongStruct(); causes the compiler to--once--allocate space to hold a VolatileLongStruct instance, and then on each pass through the loop mutate that pre-existing instance by zeroing out all its data (using normal, rather than volatile, writes). Note that if code will require structs fields to have particular multi-thread semantics, such fields should often be made public, and the struct should be regarded as being a gro

Categories : C#

How do I create a table that has a composite key each member of which is a foreign key member to other tables
By convention, cascade deletes are handled by the introduction of the actual foreign key into your model. If you use a non-nullable foreign key, it will require delete. Use a nullable foreign key to turn it off. Change your class to the following by making the foreign keys nullable: [Table("CustomerAppointments")] public partial class CustomerAppointment { [Key,Column(Order=0)] public int? CustomerId { get; set; } [Key,Column(Order=1)] public int? VehicleId { get; set; } public DateTime? AppointmentDate { get; set; } public DateTime? AppointmentTime { get; set; } public string AvailableDays { get; set; } //other fields [ForeignKey("CustomerId")] public virtual Customer Customer { get; set; } [ForeignKey("VehicleId")] public virtual

Categories : C#

Java - reducing visibility - member data vs member functions
By declaring a new instance variable named x in Child class , you are hiding the super class instance variable x. Within a class, a field that has the same name as a field in the superclass hides the superclass's field, even if their types are different.Within the subclass, the field in the superclass cannot be referenced by its simple name. Instead, the field must be accessed through super. Read the tutorials for more information. You can write a method in class Child as: public int getParentDataMember() { return super.dataMember; } And access the member as : System.out.println("Child dataMember = " + c.getParentDataMember());

Categories : Java

Error: invalid use of member in static member function
Your class and member (screen) are not static, which means they don't actually exist. You can't access a non static member in a static function. Try to make your data members to be static.

Categories : C++

Don't inherit private member if it's accessed by public member
This situation -- where a class has data members that you do not want to inherit -- is called the "Refused Bequest" antipattern, and what it generally means is that your inheritance relationship is wrong. Rather than having B extend A, you need an interface C that both implement independently. If there is significant implementation that you do want to share, then perhaps you could introduce an abstract base class that A and B could share.

Categories : Java

How to allow templated functor work on both member and non-member functions
You will definitely need some kind of default implementation for a class. But the good news is that this can be foreseen by the logger class itself. Just replace template<typename RetType, typename Arg1Type, typename Class> with template<typename RetType, typename Arg1Type, typename Class=DefaultDummyClass> of course the DefaultDummyClass has to be foreseen, but it no longer has to be provided by somebody who wants to use the logger class.

Categories : C++

Select one member from JSON result based on member value
You could put them all into an array of objects, and then have some sort of key on the objects, or you could just loop through the results: $.each(sizeResults, function(index, value) { if (value.label == "Large") { photoURL = value.source; return false; // breaks out of the loop. } }); Certainly not efficient, but it should be fast enough...

Categories : Javascript

Static member array of pointers to member functions
If you have non static member functions with no arguments and returning bool you should write something like typedef bool (Hand::*hfunction_non_static)(); hfunction_non_static f_non_static [] = { &Hand::has_sflush, &Hand::has_poker, ....... }; Hand h; (h.*f_non_static[0])(); If you have static functions you should write something like typedef bool (*hfunction_static)(); hfunction_static f_static [] = {&Hand::has_sflush, ....}; f_static[0]();

Categories : C++

Non-member operator as private member of foreign class
It is not possible to make a version of operator == the way you want. It can't be made static. If it is a member, then it must take one argument. If you are willing to "duplicate code", then you can play tricks with namespaces. Your generic interpreter could be a template that takes a language specific derived class as a template parameter. It in turn calls a templated operator== based on a language specific token. template <typename TOKEN> bool operator == (const std::string &l, const TOKEN token) { return token == l; } // Language specific interpreters inherit from this template template <typename LANG> class Interpreter { public: void interpret () { std::string s("hi"); if (s == LANG::KEYWORD_ELSE) {} } }; Each language specific subclass

Categories : C++

accessing private member of member class
public class A { private int myMember; public int getMyMember() { return myMember; } public void setMyMember(int myMember) { this.myMember = myMember; } } public class B{ private A myA; public B() { myA = new A(); myA.setMyMember(0); int a = myA.getMyMember(); } }

Categories : Java

Select ID from GROUP BY group if the group satisfied criteria
you should check beluw link http://www.w3schools.com/sql/sql_where.asp should use where caluse like 'where shipping_date = null '

Categories : SQL

How to choose between member and non-member functions?
If you need to calculate the area of polymorphic Shape objects, then Scott's advice is not for your case. Because you cannot calculate the area with an external function, because in fact you don't have public access to the information that is required. Namely, whether the object is actually a circle, a rectangle, or something else. So this is a job for virtual functions. In fact, in Scott's psuedo-code algorithm for determining the correct placement of a function (taken from this article, as I do not have the book), the first test is this: if (f needs to be virtual) make f a member function of C;

Categories : C++

overloading a member inside another member
First I would suggest use std::string in favour of char[]. It will save a lot of trouble. For reading ISBN I would write something like this: bool ISBN::read(istream& is) { ISBN result; // reading into result std::swap(*this,result); return !quit; } Or even better (as a non member function): std::istream& operator>>(istream& is, ISBN& obj) { ISBN result; // reading into result is(!quit) is.clear(std::ios_base::failbit); std::swap(obj,result); return is; } In any way you should RAII classes for your resources. In your special case std::string instead of char[].

Categories : C++

data member 'vec' cannot be a member template
Vector always need a class T as template. But the template should be put ahead of class declaration. You probably mean template<class T> class A { private: std::vector<T> vec; };

Categories : C++

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

How do I capture a group that matched a pattern using spring and concatenate the matched pattern to another string?
I don't think this has anything to do with Spring, but you can just do a simple string regular expression replace, for example: String result = "sshexclude1".replaceFirst("exclude", ""); Will give you "ssh1"

Categories : Java

call a class member to get default parameters for another member function of same class
listGraph getPlanarGraph(const vector<int> &nodeSe=this->getLabels()); ... isn't possible because when a method is being called, this refers to whichever class instance is calling the method, not to an instance of the class to which the method belongs. this only refers to the instance of the class to which the method belongs once the method is being executed. As to why it isn't possible, the line above is somewhat similar to calling the method like this: x xinstance; const vector<int> nodeSe labels = this->getLabels(); listGraph lg = xinstance.getPlanarGraph(labels); This code would work, but you can see clearly that this refers to the instance of whatever class contains the lines of code above, not to xinstance. As @Ivan Aucamp pointed out in the commen

Categories : C++

__class_ data member in python, how it is different from static data member in java
The problem is this line while not PizzaShop.pizza_stock: This will stop immediately if pizza_stock is nonzero. Which it always is. You probably intended to write while PizzaShop.pizza_stock: Anyway, if you want to find the details on how values, classes, etc. behave in Python, you should check the docs. It's very different from Java. P.S. The following is unnecessary as str.format has a shorthand for calling repr. Also, you shouldn't call magic methods like .next directly. Use the builtin next() instead. print "{}".format(repr(pizza_order.next())) Should be print "{!r}".format(next(pizza_order))

Categories : Python

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

MySQL Query to Determine if Member is a Friend of a Friend to another Member
For a moment, don't think of it as of a table. In order to qualify for a mutual friend, a user must be in my circle AND other user's circle. Intersection of sets. So you have: SELECT * FROM profiles WHERE id IN (SELECT viewers friends IDs) AND id IN (SELECT the viewed users friends IDS); Write sub-queries is left as an exercise ;)

Categories : PHP

In python ,how to add class member function pointer in class member?
UPDATE: There's no way to get the syntax you want, since there's no way for self.__class__.functionMap[itemName] to know which instance it should operate on. However, if you pass self explicitly, you can get very close: class MyClass: def __detectWhichItemClicked(self): itemName = getItemName() if itemName in self.functionMap: # Pass self into the call self.functionMap[itemName](self, arg) ... # This goes after the __handle methods are defined. functionMap = { "ITEM1": __handleRightClickItem1, ... } # Equivalent. getattr(obj, "foo")(arg) getattr(MyClass, "foo")(obj, arg) obj.foo(arg) MyClass.foo(obj, arg) # Also equivalent bound_method = obj.foo # or getattr(obj, "foo") bound_method(arg) # Still equivalent u

Categories : Python

jQuery Validation plugin - validate group of input fields and at least one group is required
I found a solution by customizing require_from_group method (based on Jquery .validate require_from_group) : jQuery.validator.addMethod("require_from_group_with_radio", function(value, element, options) { var numberRequired = options[0]; var selector = options[1]; var fields = jQuery(selector, element.form); var filled_fields = fields.filter(function() { // check if not empty and radio is checked return jQuery(this).val() !== "" && jQuery(this).closest("tr").find("input:radio").is(":checked"); }); var empty_fields = fields.not(filled_fields); // we will mark only first empty field as invalid if (filled_fields.length < numberRequired && empty_fields[0] == element) { return false; } return true; }, jQuery.fo

Categories : Jquery

How to add additional field to drupal organic group 'User and Group' relation?
I will probably deal with the same problem soon. I think a possible workaround is to use the relation module and the rules module. You could set up a rule to create a relation each time a user is assigned to a group, or something like that. Relations made by the relation module are fieldable. But it would be maybe better to add a field to the og user-group relation directly. Update: now that I tackled the issue, I have a different solution. We don't need to add new relations, the og_membership shipped standard with og is all that we need. This is how I did it. I created a new membership type from admin/config/group/group-membership. It's a fildable entity so I added the required fields: in your case it will be "description". Then I changed the used membership type per u

Categories : Drupal

twitter bootstrap input-group-addon and btn-group not aligning nicely
Here is my jsbin for how I fixed it. jsbin When you set the input-group sizes either 'input-group-lg' or 'input-group-sm' it will give you predefined sizes - most notably a height of 46px or 30px for the inputs respectively. However nothing happens if you accept the regular size. I think this is so you aren't surprised if you have settings for inputs outside of Bootstrap. Here are example measurements for lg .input-group-lg > .input-group-btn > .btn { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.33; border-radius: 6px; } Instead of tweaking lg after the fact, I created a class called 'input-group-reg' uses measurements that are a middle ground between the 'lg' and 'sm' given by bootstrap. .input-group-reg > .form-control { height

Categories : HTML

How to group together sequential, timestamped rows in SQL and return the date range for each group
try-: DECLARE @TempTable AS TABLE ( [Registration] [nvarchar](50) NOT NULL, [Date] [datetime] NOT NULL, [DriverID] [int] NULL, [TrailerID] [int] NULL ) INSERT INTO @TempTable VALUES ('AB53EDH','2013-07-03 10:00', 54,23), ('AB53EDH','2013-07-03 10:01', 54,23), ('AB53EDH','2013-07-03 10:45', 54,23), ('AB53EDH','2013-07-03 10:46', 54,nULL), ('AB53EDH','2013-07-03 10:47', 54,NULL), ('AB53EDH','2013-07-03 11:05', 54,NULL), ('AB53EDH','2013-07-03 11:06', 54,102), ('AB53EDH','2013-07-03 11:07', 54,102), ('AB53EDH','2013-07-03 12:32', 54,102), ('AB53EDH','2013-07-03 12:33', 72,102), ('AB53EDH','2013-07-03 12:34', 72,102) SELECT t1.Registration, MIN(t1.Date) AS StartDate, MAX(t1.date) AS EndDate, t1.DriverID, t1.TrailerID FROM @TempTable AS t1 INNER JOIN @TempTable AS t2 ON

Categories : SQL

jQuery mobile button group: How to center the complete vertical group?
See this fiddle http://jsfiddle.net/bB2vM/ i wrapped your radio button group in a div and it worked see the fiddle <div data-role="page" id="testPage" data-theme="e"> <fieldset data-role="controlgroup"> <legend id="SettingsDifficulty"></legend> <div id="centregroup"> <input class="rbgroup1" type="radio" name="test" id="radio-choice-1" value="3" /> <label for="radio-choice-1" id="label1" class="activeOnce">Radio 1</label> <input class="rbgroup1" type="radio" name="test" id="radio-choice-2" value="4" /> <label for="radio-choice-2" id="label2" class="activeOnce">Radio 2</label> <input class="rbgroup1" type="radio" name="test" id="radio-choice-3" value="5" /> <label for="radio-choice-3"

Categories : CSS

qplot error: "each group consists of only one observation. Do you need to adjust the group aesthetic?"
I think in your problem, you should change data=mydata to data=data, then it should work. Here is a solution: data <- structure(list(date.time = structure(c(1308288600, 1308290400, 1308292200, 1308294000, 1308295800, 1308297600, 1308299400), class = c("POSIXct", "POSIXt"), tzone = ""), temperature = c(71.1, 71.1, 71.1, 70.8, 70.8, 70.8, 70.5)), .Names = c("date.time", "temperature"), row.names = c(NA, -7L), class = "data.frame") data$date.time <- as.POSIXct(data$date.time,format="%m/%d/%Y %H:%M") library(ggplot2) qplot(data=data,x=date.time,y=temperature,geom="line") The output is as follows:

Categories : R

Significance of --start-group and --end-group linker flags for dynamic libraries
Dynamic libraries, unlike static libraries, are loaded even if they provide no useful symbols. This makes the order much less relevant. With static libraries, the wrong order can lead to required libraries, or objects within a .a file, not to be taken, even if they're later needed. This is what --start-group and --end-group solve. With dynamic libraries, both orders work. Suppose liba.so exports a and libb.so requires it. If liba.so is loaded first, then when libb.so is loaded, it will use it. If libb.so is loaded first, then a will be unresolved for a while, until liba.so is loaded. Either way, it works.

Categories : C



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