w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
@Value returning null
Are you passing valid value expressions? For properties placeholder you can use something like: @Value("${directory.extDirectory}") You can also use Spring EL and get all the goodness from it using the #{value} check the docs here Is also possible to assign a default value in case the property is not found @Value("${directory.extDirectory:defaultValue}")

Categories : Spring

Why isn't this returning null?
You should use isNaN(value); to check for NaN Because: console.log(NaN === NaN); // false! NaN is not equal to itself. This may seem weird but it makes sense if you think about the nature of NaN. Let's say you have this code: var a, b, c; // a = 0;oops a is still undefined so we'll get NaN if we do an operation with it b = 5; c = 6 if (a + b === a + c) { console.log("math error?"); } You don't want to come to the seeming conclusion that 5 === 6.

Categories : Javascript

Why is this returning a NULL
I bet this runs on a 64bit system and your code looks like this: int main() { char *str=get_str(); printf("received str %s with len %d ", str, strlen(str)); } char *get_str() { char *str; int slen=get_strlen(); str=(char *)malloc(sizeof(char)*slen); set_str(str); printf("returning str %s with len %d ", str, strlen(str)); return str; } To fix this, add the appropriate prototyping: char *get_str(); before the function's first usage. On (most?) 32bit systems pointer are 32bit wide, which is the same size as an int to which the compiler defaults the function as the prototpye is missing, so although using a wrong type the value gets pass back up successfully. The latter won't work anymore on a 64bit system as pointers (on most systems) are wider than a

Categories : C

WURFLManager always returning null
Well I found the answer. It seems as though the API must have changed at some point. I'm not able to find out if the DLL we are using has been updated. But anyway here is the solution: var mgr = WURFLManagerBuilder.Build(new ApplicationConfigurer()); var device = WURFLManagerBuilder.Instance.GetDeviceForRequest(Request.UserAgent);

Categories : Misc

getResourceAsStream("abc.xml") returning null
Your code is working. All you need to do is to check if src/test/resources is on your classpath and you should be fine (Project properties -> java build path) I just recreated your scenario and it worked fine. //Both snippets should work (don't forget to prepend a slash if using getClass().getResourceAsStream) System.out.println(this.getClass().getClassLoader().getResourceAsStream("a/b/c/file.txt")); System.out.println(this.getClass().getResourceAsStream("/a/b/c/file.txt"));

Categories : Java

shell_exec() returning null on "ls"
Add 2>&1 to the end of your shell command to have STDERR returned as well as STDOUT. $output = shell_exec("ls /root/files/saves 2>&1"); Also, if the user running PHP don't have the sufficient permissions to view the output in /root/, then the above code will return a Permission denied error message. Source: http://php.net/manual/en/function.shell-exec.php#28994

Categories : PHP

combobox returning null value in c#
Reason is clear that you have no text selected You've to select any item in combobox first. To do so try any of the following Set SelectedIndex to some valid index Set SelectedItem to a valid item in combobox through code Select an item in combobox by clicking it Then use following code MessageBox.Show(comboBox1.SelectedText); or if(comboBox1.SelectedItem != null)//check for null since `SelectedItem` can be null when nothing selected MessageBox.Show(comboBox1.SelectedItem.ToString()); Note: As @tim pointed in comments SelectedText approach won't work when DropDownStyle set to DropDownList. In that case you've to use SelectedItem approach

Categories : C#

strtok returning null at the end
Fix as below :- if (strncmp(command, "echo", MAX_INPUT_SIZE) == 0) { space = strtok(NULL, " "); //eat the "echo" while (space != NULL) { printf("%s ", space); <----+ space = strtok(NULL, " "); | // printf("%s ", space); -----+ } }

Categories : C

startActionMode returning null
So I finally found a workaround which is probably NOT the best solution, but i didn't find any other solutions. I did a kill process in the onDestroy on my activity. like this : android.os.Process.killProcess(android.os.Process.myPid()); It is working now. It seems that my phone wasn`t clearing the memory of something. EDIT: I can't use this solution because I have a service which need to be open even if the app is closed. The killProcess kill the service too. EDIT 2 I finally found the source of my problem. I was keeping a static variable of one of my fragment. For some reason, that variable was kept in memory even when restarting the app. I still don`t know exactly why startActionMode is returning null. To fix it, i've instantiate my variable in the onCreate of my activity.

Categories : Java

Returning NULL Structure
Your function return type is CvBox2D, so you can't convert a (NULL) pointer to it. If you really need to return "nothing" if the check inside the function fails, you can change the return type to a pointer to CvBox2D: CvBox2D* function() { ... } You will also have to change the way the returned object is created inside your function. Note that using raw pointers in C++ usually isn't a good idea. Take a look at std::shared_ptr (available in C++11) if you think you really have to use pointers.

Categories : Opencv

imageItem returning null in c#
The as operator is like a cast operation. However, if the conversion isn't possible, as returns null instead of raising an exception so if current item in layer.Items is not ImageItem you get null assigned to imageItem in this line ImageItem imageItem = item as ImageItem;

Categories : C#

lua_touserdata is returning null
I think it may be the way your dealing with the userdata's metatable. Specifically, I think what you're returning from createUserInfo() is a table not a userdata. What I suggest is that you create the metatable once e.g. in luaopen, and then just set that on the new userdata. Something like this... int createUserInfo(lua_State *L) { UserInfo *userInfo = [[UserInfo alloc] init]; UserInfoData **userInfoData = (UserInfoData **)lua_newuserdata(L, sizeof(userInfo)); *userInfoData = userInfo; luaL_getmetatable(L, "userInfoMeta"); lua_setmetatable(L, -2); return 1; } LUALIB_API int luaopen_XXX(lua_State *L) { luaL_newmetatable(L,"userInfoMeta"); luaL_openlib(L, NULL, userInstance_methods, 0); lua_pushvalue(L, -1); lua_setfield(L, -2, "__index"); ...

Categories : Objective C

Moq Setup returning null
Assuming that your interface is declared similarly to the following: public interface IGenericRepository<T> { T SingleOrDefault(Func<T, bool> predicate); } Specifying a delegate in Setup won't work. See Issue 300: Mocking Method with Delegate as Parameter. I get a NotSupportedException when I tried it. Instead, try this: accountRepositoryMock.Setup(r => r.SingleOrDefault(It.IsAny<Func<Account, bool>>())) .Returns(new Account { AccountId = 99999999, Valid = true }); There's a more detailed example at Moq framework Func<T,T>

Categories : Misc

SQL query returning null?
You shouldn't try to select a new custom ID like this before you actually insert the record, as someone else may insert that same value before you. So here's how you can potentially run your table inserts: insert into John_IEP_Crossing_Dock_Shipment (MyCol1, MyCol2, ID) select @MyFormValue1, @MyFormValue2, convert(varchar(10), current_timestamp, 20) + '-' + right('000' + cast(cast(right(coalesce(max(ID), '0'), 4) as smallint) + 1 as varchar(4)), 4) from John_IEP_Crossing_Dock_Shipment where ID like convert(varchar(10), current_timestamp, 20) + '%'; -- like may use an index in this case We're coming up with the ID during the insert, not before. This should mostly solve the contention issue (heck, you can only have 9,999 inserts per day anyway with that 4-digit I

Categories : SQL

why is my php code returning a null value?
Trail and error debugging when the php code is sending you the null value.. i think you mean 0 with null? Because i think your code breaks here? catch (PDOException $ex) { $response["success"] = 0; $response["message"] = "Database Error. Couldn't add post!"; die(json_encode($response)); }

Categories : Java

GetMethod returning null
As you've discovered in your edit, the actually ASPX page gets compiled into a class that inherits from _Default (where your code is located). So you need to make DynamicHandler (at least) protected rather than private. Specify BindingFlags.FlattenHierarchy also: this.GetType().GetMethod("DynamicHandler", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);

Categories : C#

PHP: array_search returning null
Assuming that your array will always contain contiguous numbers, and you can verify that your second SQL call returns one of those numbers, I would say something like $value = $freeRooms[$roomNb] I'm personally unfamiliar with how array_search executes, however if you wanted to write your own, I assume it would look something like this function IndexOf($searchValue,$array) { $i = 0; for( $i = 0; $i < count($array); $i++ ) if( $array[$i] == $searchValue ) return $i; }

Categories : PHP

STR_TO_DATE() Returning NULL
You'd need to assign something to the variable you're using with STR_TO_DATE, something like LOAD XML LOCAL INFILE 'C:\xampp\mysql\data\test.xml' REPLACE INTO TABLE games (id, GameTitle, @var1) ROWS IDENTIFIED BY '<Game>' SET ReleaseDate = STR_TO_DATE(@var1, '%c/%e/%Y'); Note that the syntax for SET in LOAD XML is described in the syntax for LOAD DATA

Categories : Mysql

twitter api 1.1 - returning NULL
It works fine for me. My results are here: http://pastebin.com/FB1zpuuT Start by verifying that you can connect to this in your web browser. https://api.twitter.com/1.1/statuses/user_timeline.json If you can connect to that, you will see an error message. If not, the problem is likely your network blocking Twitter, or Twitter blocking your ip address.

Categories : PHP

LayoutParams returning null
Here tc.getLayoutParams() you haven't given it any params yet so it will return null. Maybe you meant descriptiontv.getLayoutParams() Edit Try changing params.leftMargin = 30; params.rightMargin = 30; to params.setMargins(30, 0, 30, 0); And change LinearLayout.LayoutParams params = (android.widget.LinearLayout.LayoutParams)tc.getLayoutParams(); to LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

Categories : Android

JSP getAttribute() returning null
You are not typecasting it to String. request.getAttribute() will return an Object. Try using this and see if it works: String value = (String)request.getAttribute("colnames"); Or <%= (String)request.getAttribute("colNames") %> Why are you using forEach here? You just need to display a String right? Also, shouldn't var="col" be ------> var = "colNames" <tr> <c:forEach items="${param.colNames}" var="col"> <td>${col}</td> </c:forEach> </tr>

Categories : Java

View returning null
You should use findViewById() only once in the right context. Three ways you could achieve this with your code: Change Activity to contain your GestureListener and the AsynkTask as inner classes and reference the field iv of your Activity Keep GestureListener and AsynkTask as standalone classes and add the MyImageView as parameter to their constructor. Construct the two instances for this two classes in onCreate() after the findViewById() Put GestureListener and AsynkTask as inner classes of MyImageView and add MyImageView as parameter to their constructor. When constructing the two instances from within MyImage just pass this. findViewById() is context sensitive. This means it searches for a view starting at the current context. If the current context is an Activity it searches thru t

Categories : Android

Node Js (Returning null)
I had the same problem. I got my code to work by using ObjectID in the 'mongodb' library: var ObjectID = require("mongodb").ObjectID; //more code here query._id = { $gt: ObjectID(myId) }

Categories : Node Js

Returning another value if preferred value is null
You need the coalesce function which looks like: SELECT COALESCE(T1.PRICE,"MISSING") FROM [TABLE] You can find more information on it in your RDBMS' documentation but this will return "missing" if the field returns a NULL.

Categories : SQL

NSDate returning NULL
The space between hh:mm and a in your format string is likely causing it to fail. Instead you'll want to do this: [dateFormatter setDateFormat:@"yyyy-MM-dd hh:mma"];

Categories : IOS

Xml Parsing returning null tag
this code works for me..suit it according to your needs Edit: for parsing from iternet: URL url = new URL("http://api.discogs.com/artist/ac/dc"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(url.openStream())); doc.getDocumentElement().normalize(); XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); Dom parser DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse("D:/workspace1/dd.xml"); XPathFa

Categories : Android

Why below function returning me null instead of 1?
Your function returns nothing until your array count is 1. Because your return statement is in if block. <?php function endWithNumber($input) { if (count(array_unique($input)) == 1) return $input[0]; $maxVal = max($input); $maxKey = array_search($maxVal,$input); foreach ($input as $k => $v) { if ($maxKey != $k && $maxVal != $v) { $newVal = ($maxVal - $v); $input[$maxKey] = $newVal; break; } } return endWithNumber($input); } $input = array(6,10,15); var_dump(endWithNumber($input)); exit; ?>

Categories : PHP

Jaxb returning null value
The mappings on your object model do not map the XML document this is why it isn't populating correctly during the unmarshal operation. You can get a sense of this by populating your object model and then marshalling it to see the XML output. Below is a set of mappings you could use instead. JAVA MODEL XmlImportConfig Since indexFields is a repeating element it is best to map it to a list field/property. import java.util.ArrayList; import javax.xml.bind.annotation.*; @XmlRootElement(name="XmlImportConfig") @XmlAccessorType(XmlAccessType.FIELD) public class XmlImportConfig { @XmlElement(name="indexfields") private ArrayList<IndexFields> listOfIndexFields; public ArrayList<IndexFields> getListOfIndexFields() { return listOfIndexFields; } } Inde

Categories : Java

findFragmentByTag returning null
Try using the tag on the activity's FragmentManager directly. The complete reference of your example seems to be this. Follow this example with more details, you will see that the writer keeps track of tabs and their tag.

Categories : Android

MemoryStream->ToArray() returning null
You forgot to flush the final block. Block cipher modes normally require a full block to be written. The last block contains the padding, and the implementation only adds the padding to the plain text when it has received the last byte of plaintext. It cannot determine if there is any data coming in after Write, so it won't pad. Therefore the last - and probably only - block of ciphertext is not written. Just flushing won't work, as that only makes sure as many bytes are written to the output stream as possible. But those bytes may not be the last bytes. Closing the output stream should work as well, as the stream can then determine that the last bytes have been written.

Categories : Visual Studio 2010

why does SELECT SCOPE_IDENTITY() returning null?
Try appending SELECT scope_identity() to your first query and then capture the identity using var identity = cmd.ExecuteScalar() instead of running cmd.ExecuteNonQuery().

Categories : Asp Net

LocationClient getLastLocation() returning null
mLocationClient.getLastLocation(); might return null if you don't have any last location saved by the device. If you read its documentation, it says; It returns the best most recent location currently available. If a location is not available, which should happen very rarely, null will be returned Also inside the onLocationChanged method you might want to set the Location to the latest location, when your location gets changed. @Override public void onLocationChanged(final Location location) { mCurrentLocation = location; }

Categories : Java

mvc 4 complex list returning null
You can create a partial view for ActivityService and render this in foreach: In your actual view: @foreach(ActivityService item in Model.ActivityServices) { @Html.Partial("ActivityService", item) } In a new partial view ActivityService.cshtml: @model Proyect.Models.ActivityEditViewModel.ActivityService @Html.HiddenFor(m => m.ServiceID) @Html.LabelFor(m => m.OutcomeComment) @Html.TextBoxFor(m => m.OutcomeComment)

Categories : Asp Net Mvc

Returning null after form submission
Your check is INVERSE of what it should be (if at all its voornaam and not first_name ) if(!isset($_POST['voornaam'])) {echo 'yes!';} else {echo 'no!';} That means if voornam is NOT set then say yes and if it is set then say no Should be if(isset($_POST['voornaam'])) {echo 'yes!';} else {echo 'no!';}

Categories : PHP

getResourceAsStream returning null with TagSupport
Why does your app.properties reside in /WEB-INF? If it would've been /WEB-INF/classes, you could simply call getResourceAsStream("/app.properties"). This is because the argument to getResourceAsStream(...) is resolved relative to the classpath.

Categories : Java

findFragmentByTag always returning null on trying to retrieve after add()
Your fragment should search for your fragments using the getSupportFragmentManager() instead of the getFragmentManager Method() in your if structure. BTW, What is that R.id.dish_fragment object? A fragment? A container? It should be a container like a LinearLayout.

Categories : Android

text file returning null and 0.0
You're incrementing index before you print items so you try to print items that were not yet added, which have default-constructed values of null and 0.0d your arrays are filled with when they're created. Just reordering the following lines like this shall help: System.out.println(studNum[index] + grade[index]); index ++;

Categories : Java

.getAttribute("maxlength") is now returning null for IE7
Try this var element = document.getElementById('test'); var maxLength, defaultLength = 100; if (element.attributes.maxLength && element.attributes.maxLength.specified) { maxLength = element.attributes.maxLength.nodeValue || defaultLength; } else { maxLength = defaultLength; } Demo

Categories : Javascript

tableView cell returning NULL
You should not use the label from the cell, because it is part of the view. Although the cell is correct, its visuals may be disposed by the time the prepareForSegue: is called. The MVC way of doing this would be querying the underlying data source for the data at the cell's row, and use that data instead of the label. Here is what I mean: somewhere in the implementation of cellForRowAtIndexPath: you have code that looks like this: NSString *labelData = [myDataSource objectAtIndex:indexPath.row]; cell.textLabel.text = labelData; You should replicate that code inside your prepareForSegue: method: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(UITableViewCell *)sender { NSUInteger row = [self.tableView indexPathForCell:sender].row NSString *labelData = [myDataSource

Categories : IOS

UIImagePickerController returning Null for certain images
Your code is incorrect. construction "?:" should be this: (bool expression)? "choose if YES" : "choose if NO". In your code isn't present "choose if YES". I don't understand while compiler pass this but may be it put "nil" for "choose if YES". I've noted that EditedImage never be nil so You always choose nil. The correct code should be: UIImage* outputImage = [info objectForKey:UIImagePickerControllerEditedImage] ? [info objectForKey:UIImagePickerControllerEditedImage] : [info objectForKey:UIImagePickerControllerOriginalImage]; but take in mention that i never see [info objectForKey:UIImagePickerControllerEditedImage] == nil )))) Sorry for my bad english. Good luck!

Categories : Iphone



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