w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Spring-Security PasswordEncoder returns null
Do you actually inject the encoder into Encode.java somehow somewhere? If not,then that is your problem. if you need a quick and dirty solution which will probably work. just make it private ShaPasswordEncoder passwordEncoder=new ShaPasswordEncoder(256); and then find out what you are doing wrong with the injection. maybe read this to see how injection should be done. What is the difference between @Inject and @Autowired in Spring Framework? Which one to use under what condition?

Categories : Java

Spring Security SecurityContextHolder.getContext().getAuthentication() returns null
I have an idea but I am not sure at all (I do not have any expiriance with SS+CAS and I do not like declare SS filters manually in the conf). I know that there is a SecurityContextPersistenceFilter that is responsible for populating SecurityContextHolder. Please check is it fired in your dev config? And if it is fired, please check the same thing for your production environment. Hope this helps.

Categories : Java

Spring's SecurityContextHolder.getContext().getAuthentication() returns null after RedirectView is used in HTTPS/SSL
The SecurityContextHolder.getContext().getAuthentication() becoming null after redirect is correct since it is threadbound. But it should be repopulated from the session. Therefore try to keep track of the SPRING_SECURITY_CONTEXT Attribute in the Session. HEre is some example code to get an idea: HttpSession session = request.getSession(true); sysout(session.getAttribute("SPRING_SECURITY_CONTEXT")); In the Spring Security documentation there is a Part about how HTTPS/HTTP switching can screw up the session perhaps there is a hint to your problem somewhere in there. http://static.springsource.org/spring-security/site/faq.html#d0e223 The above FAQ leads to an examination of how the session is handled in your application. I probably would start looking at the AuthenticationSuccessHandler

Categories : Java

Date returns null values after submiting edit form in php
Hi if the date filled is getting null please send the schema of table or mention the data type of date field. The date field is getting null because you are trying to save improper data types. data type date accept date in yy-mm--dd format and you are giving %m/%d/%Y format due to which it is getting null. Hope it will hepl you.

Categories : PHP

Non-null auto-incrementing column — but 'is null' query returns just-inserted row
Check your "innodb_flush_log_at_trx_commit" system variable and set it to 1 and then try again

Categories : Mysql

LINQ VB.NET Check Date between Effective and End Date (End Date can be null)
.Where(Function(x) _ x.srvc_def_desc = txtSrvDefDesc.Text.Trim() _ AndAlso txtsrvEffDt.SelectedDate >= x.eff_dt _ AndAlso (Not txtSrvEffDt.HasValue() OrElse txtsrvEffDt.SelectedDate <= x.end_dt)).Count() which can be simplified to (if the Count is all you're interested in): .Count(Function(x) _ x.srvc_def_desc = txtSrvDefDesc.Text.Trim() _ AndAlso txtSrvEffDt.SelectedDate >= x.eff_dt _ AndAlso (Not txtSrvEffDt.HasValue() OrElse txtsrvEffDt.SelectedDate <= x.end_dt))

Categories : Vb.Net

SoapClient Returns "NULL", but __getLastResponse() returns XML
you should give an option parameter as below : <?php // below $option=array('trace',1); // correct one is below $option=array('trace'=>1); $client=new SoapClient('some.wsdl',$option); try{ $client->aMethodAtRemote(); }catch(SoapFault $fault){ // <xmp> tag displays xml output in html echo 'Request : <br/><xmp>', $client->__getLastRequest(), '</xmp><br/><br/> Error Message : <br/>', $fault->getMessage(); } ?> "trace" parameter enables the output of request. Now, you should see the SOAP request. (source: PHP.net

Categories : PHP

How to sort column based on null/not null values using Spring Repository?
Have a look at section 6.3.3 of Spring Data MongoDB about type-safe query. You can implement QueryDslPredicateExecutor on your repository interface: public interface PersonRepository extends MongoRepository<Person, String>, QueryDslPredicateExecutor<Person> { // additional finder methods go here } And you can use this method: List<T> findAll(Predicate predicate, OrderSpecifier<?>... orders); The OrderSpecifier constructor takes a NullHandling enumeration parameter which you can set to NullsFirst / NullsLast.

Categories : Java

typeof (Array, null) returns object and typeof(null, Array) returns function
Because typeof is an operator, not a function, so typeof(expr) is typeof expr, with expr evaluated first a,b returns b So typeof (a, b) returns typeof b and in your case typeof (Array, null) is typeof null which is "object" typeof(null, Array) is typeof Array, and Array is a function.

Categories : Javascript

Query between dates only returns results if a selected date is equal or greater than date in data
The answer is not to use Between. Seperate that line in the WHERE clause into two and explicitly specify wheter or not to include that date by using a >= or just a >. AND date_in > "1/07/2013" or date_in >= "1/07/2013" AND date_in < "1/08/2013" or date_in <= "1/08/2013"

Categories : Mysql

date object returns random date for invalid months/day
That date is not in a format that is specified to be supported by the Date constructor. I'm not surprised to find that most engines call it invalid, but apparently Firefox is attempting to make a date out of that. Even though it's not specified, most engines support month/day/year and all, last I checked, support year/month/day. Firefox appears to be applying year/month/day to the input, where most browsers see the invalid values and go with "invalid." So Firefox is seeing 82 for year (and assuming 1982), 66 for month, and 2005 for day. JavaScript is usually very forgiving about out-of-bound values on dates, moving to the next month and such as necessary. And that's what's happening here: If you take January 1st 1982 and add a further 65 months and 2004 days, you end up on Nov 25 1992. T

Categories : Javascript

Date Box on Form doPost returns as string, not Date Object
e.parameter return indeed always a string. To convert it to a date object you could simply re-create a date like this : var d = e.parameter.date.split('-');// separate day,month and year var dateDate = new Date(d[0],d[1]-1,d[2],0,0,0,0);// month count from 0 >> -1 on d[1] Logger.log(d+' '+dateDate); // check result in the logger // returned value example = 2013-07-31 -> date object construction = new Date(year, month, day, hours, minutes, seconds, milliseconds); EDIT : to set hours , minutes and seconds you should use date.setHours(Number(e.parameter.timeHour.replace(/[^0-9]/g,'')), Number(e.parameter.timeMin.replace(/[^0-9]/g,''))); // use numbers as arguments and eliminate all other characters eventually present (for example if you use "11 hours" instead of sim

Categories : Javascript

Attribute.IsDefined returns false, Attribute.GetCustomAttribute returns null for defined ActionNameAttribute
I would just have: //If we've so far failed to find the method, look for methods with ActionName attributes, and check in those values: foreach (var method in methods) { var attr = method.GetCustomAttribute<System.Web.Mvc.ActionNameAttribute>(); if (attr!=null && attr.Name == expectedActionName) { return true; } } As I said in comment, I suspect that you're picking up the wrong ActionNameAttribute in your typeof calls, so I've been explicit

Categories : Asp Net Mvc

getExternalFilesDir(null) returns null
This is from Android documentation: Returns the path of the directory holding application files on external storage. Returns null if external storage is not currently mounted so it could not ensure the path exists; you will need to call this method again when it is available. The other option is you can check if External storage is available: String state = Environment.getExternalStorageState(); File filesDir; // Make sure it's available if (Environment.MEDIA_MOUNTED.equals(state)) { // We can read and write the media filesDir = getExternalFilesDir(null); } else { // Load another directory, probably local memory filesDir = getFilesDir(); }

Categories : Android

How do I bind two date fields in my model to different date formats in Spring?
Instead of init binder you can use @DateTimeFormat @DateTimeFormat(pattern = "dd/MM/yyyy") private java.util.Date startDate; @DateTimeFormat(pattern = "dd MMM yyyy") private java.util.Date meetingTime; If you use Spring older than 3.2, you might need to include joda-time on classpath

Categories : Spring

Spring MVC: Required Date parameter 'date' is not present
The exception you get (MissingServletRequestParameterException) is really only thrown when a parameter is required, but not present. The parameter can even be empty. Moreover binding happens after the parameter check. That means when you get the exception it's before the custom editor is called. The problem must be related to another method. Maybe you redirect in the filtermethod.

Categories : Java

Android - string.equals(null) returns null pointer even when string was initialized
If your timeOut variable is null, this test will always cause a NPE, because null instances have no methods. You should be testing with == operator, e.g. timeOut == null. Why it is null, however, I can't understand, since you say it has value when printed.

Categories : Android

Checking for a null date before converting to java.sql.date from java.util.date
In your code if (dateBoxArchived.getValue() != null){ sqlDateArchived = dateBoxArchived.getValue().getTime(); convert last line to sqlDateArchived = new Date(dateBoxArchived.getValue().getTime());`

Categories : Java

Conflicts with Spring 3.2.1.RELEASE and spring security 3.1.3.RELEASE. java.lang.NoSuchFieldError: NULL
It is visible from your dependency:list that you have incorrect version of spring-expression dependency: org.springframework:spring-expression:jar:3.0.7.RELEASE:compile Just add the following to your POM: <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>3.2.1.RELEASE</version> </dependency> </depdendencies> </dependencyManagement> You can alter the definition of transitive dependencies via dependencyManagement like this.

Categories : Spring

AngularJS - binding/watching a function which returns a promise
For some things, I use $resource. If I need to wait for it, $then works well: var r = $resource...get... var p = r.$then... Otherwise, I build my own resource-like object that is not a promise, but has a promise that I can wait for.

Categories : Angularjs

Checkboxes tag spring mvc and binding
I think the trick is to make sure your demOrg property is actually a collection. Check out the checkbox reference here. In particular, the text that says: Typically the bound property is a collection so it can hold multiple values selected by the user.

Categories : Spring

Set another value while binding path value is null in textblock
By looking at this code,it is difficult to say what you are trying to do here. But I would suggest you to handle this is your ViewModel. private string _property1; public string Property1 { get{ return _property1; } set { Property1 = value; OnPropertyChanged("Property1"); } } private string _property2; public string Property2 { get{ return _property2; } set { if(value!=null) { Property2 = value; }else { Property2 = Property1; } OnProperty

Categories : C#

Spring MVC: Binding complex Objects to UI
To get your Address object back, you will need to list out each of the individual properties: for ex: <form:hidden path="user.address.street" /> <form:hidden path="user.address.country" /> and so on. Now, the object that you bind to the UI is the object that you passed from your controller. I am assuming that When the form gets submitted you want to get the User object back as a @ModelAttribute. In that case, you have two options: the first is that you will need to list out all the properties of your User object on the client-side (either as hidden objects or as visible form-elements). The second options is: you only display the required properties on the client-side, and rather than listing all the other propeties as hidden fields, you only keep the id of your User instan

Categories : Spring

Spring 3.1.0 mvc binding modelattribute along with requestbody
When you submit form, data comes in form-encoded manner, and when you use XML/JSON it comes as a string in body. You'd better place all your common logic to intermediate service layer and call it in your controllers. As a result it allows you to simply build REST services on top of existing HTML pages with forms: public class Service { public void registerUser(User user){ } } @RequestMapping("users") public class FormController{ @Autowired private Service service; @RequestMapping("register") public ModelAndView registerUser(@ModelAttribute User user){ service.registerUser(user); } } @RequestMapping("service/v1") public class RESTController{ @Autowired private Service service; @RequestMapping("users/register") public ModelAndView registerUser

Categories : Java

Spring MVC Boolean not binding to checkbox
Try to change your property name to active (small letters) in your object and jsp. private Boolean active; <form:checkbox path="active" label="label" />

Categories : Spring

Ninject binding with generic repository MVC returns error on Parameterless Constructor
You need to tell the MVC runtime to use Ninject to resolve your controllers, the easiest way to do this is install the MVC extension for Ninject

Categories : Asp Net Mvc

MVC How to handle valid null model binding
try [HttpPost] public ActionResult EditPersonnel(Personnel model) { if(model.Address.Equals(null)) model.Address = new Address(); if (ModelState.IsValid) { model.Save() // or whatever } return View(model); }

Categories : Asp Net Mvc

Null/Empty binding when getting DataTemplate from ResourceDictionary
It turns out I need to register a binding converter for BindingExpression in TypeConverter in order for the serialize to work on bindings as by default they are not serialized. Needs to add this class as the ExpressionConverter public class BindingConverter : ExpressionConverter { public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, Type destinationType) { return true; } public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(MarkupExtension)) { BindingExpression bindingExpression = value as BindingExpression; if (bindingExpression == null) {

Categories : C#

Composite Component Binding is resolves to null
This is a bug. See here for details. A composite component binding attribute will not work properly for Ajax calls.

Categories : JSF

Spring MVC property/field binding exception
The error message is self-explainable. @Pattern can be used for validation of String arguments. Numbers (int, double, BigDecimal etc) are parsed automatically and do not need special validation. So, just remove your pattern or make your field String and parse it yourself. (The second solution is bad). BTW are you sure you indeed need BigDecimal to operate with money? Do you know how double big is? I think that it is big enough to hold total amount of money that have been ever printed in whole world during latest 5 thousand years.

Categories : Java

Custom annotation binding in Spring Controller
Yes, you can. Spring uses the HandlerMethodArgumentResolver (you can see the default ones in the All Known Implementing Classes area of the javadoc) interface to decide what to pass into your controller method. You can create and register your own HandlerMethodArgumentResolver to find your annotation. public class MyHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { public boolean supportsParameter(MethodParameter parameter) { return parameter.getParameterAnnotation(MyAnnotation.class) != null; } public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Except

Categories : Java

Checkboxes Spring MVC form binding error
You need to implement StringToSubjectConverter class what convert submitted string to Subject object: public class StringToSubjectConverter implements Converter<String, Subject> { @Override public Subject convert(String s) { return ...; // your code to convert from `String` to `Subject` } } And register this converter with Spring Conversion Service: <mvc:annotation-driven conversion-service="conversionService" /> <bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean"> <property name="converters"> <set> <bean class="package.StringToSubjectConverter" /> </set> </property> </bean>

Categories : Spring

getResources returns null
Encountered a similar problem, check this out. RuntimeException: Unable to instantiate application I think this should answer this question, maybe because the Resources has been destroyed during this uninstall event.

Categories : Java

hasProperty returns null
hasProperty identifies class properties binded to the metaclass of an object, whereas getProperty can be pretty arbitrary: you can write a method to return whatever you want. How can hasProperty get into that? Executing getProperty? Seems a bit weird to me. You can override hasProperty so it consider whatever logic is in getProperty: class Person { Map otherProperties = [:] def getProperty(String property) { otherProperties[property] } void setProperty(String prop, value) { otherProperties[prop] = value } boolean hasProperty(String property) { otherProperties.containsKey(property) } } p = new Person() p.name = "John" p.age = 40 assert p.hasProperty('name') assert p.hasProperty('age') assert !p.hasProperty('dob')

Categories : Grails

LOAD_FILE returns NULL
Here is my command on windows 7: select load_file("C:/Program Files (x86)/MySQL/MySQL Workbench CE 6.0.7/images/hieuImages/a.jpg"); And it worked! You maybe try to copy your images into that directory and select again in mysql.

Categories : Mysql

XML parsing returns null
First of all, I do not recommend parsing XMLs using DOM traversals. I would recommend you to use the OXMs (JaxB or XMLbeans). But still if you are interested in doing it this way: Here is the code public class T2 { public static void main(String []args) throws ParserConfigurationException, SAXException, IOException{ DocumentBuilder db = null; String xmlString = "<?xml version='1.0' encoding='UTF-8' standalone='no'?><company> <Staff id='1'> <firstname>Achyut</firstname> <lastname>khanna</lastname> <nickname>Achyut</nickname> <salary>900000</salary> </Staff></company>"; Document doc = null; InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xmlString));

Categories : Java

$.getJSON always returns null
It's maybe due to JSON hijacking. If that is the case, you have to explicitly allow get JSON on server side. I don't know which technology you use on server side. If you're using ASP.NET MVC, you have to allow get JSON using JsonRequestBehavior.AllowGet

Categories : Jquery

SQL Join Returns null
The problem is the join to the users table. You are joining from ATTENDEES. However, I think you want the owner email. This switches the joins to left outer join. This will return all matching rows in the ATTENDEES table, even when there are no matches in the other tables: SELECT oe.event_name, a.start_date, u.email FROM ATTENDEES a left outer join OWN_EVENTS oe ON oe.event_id = a.event_id left outer join USERS u on a.user_id = u.user_id WHERE a.event_id = $event_id AND a.status <> 3

Categories : PHP

PHP curl_multi_getcontent returns null
curl_multi_exec executes multithreded HTTP requests and requests may be completed not in order you have added them to multihandler$mh. To get response of completed requests you should use curl_multi_info_read function. You can read more about it on php.net http://php.net/manual/ru/function.curl-multi-info-read.php

Categories : PHP

ASP.NET Cache always returns null
Well there's a lot you can do to debug your code and arrive at a conclusion. It seems like your cached item is getting removed too frequently. 1.) Use CacheItemPriority.NotRemovable to Cache.Insert() to make sure ASP.NET doesn't removes your item whenever it feels so. use the Insert() method explained here. Check this MSDN article too. 2.) To find out the reason why your cached item is getting removed , log this removal action using CacheItemRemovedCallback delegate option of your Cache.Insert() method. Check this Insert method overload version and also this link. 3.) Make sure your dtresult as well as your reader is not null. Check the lines: SqlDataReader reader = cmd.ExecuteReader(); & dtResult.Load(reader); , together with your logs. 4.) Check your appl

Categories : Asp Net



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