empty

PHP object isset and/or empty

Is there a way to check if an object has any fields? For example, I have a soap server I am querying using a soap client and if I call a get method, I am either returned an object containing fields defining the soap query I have made otherwise I am returned object(stdClass)#3 (0) { }. Is there a way to tell if the object has anything? ...

Why do we need to use String.Empty instead of using "" ?

Possible Duplicate: In C#, should I use string.Empty or String.Empty or ? I got the warning suggesting me to use String.Empty instead of empty string "". I can't figure out why. If you do, please share! ...

PHP Append to empty string without error.

Hey folks, I have got the following issue, my function appends code to a string $string ($string .= bla), but in the beginning the string is empty, so I get this error message A PHP Error was encountered Severity: Notice Message: Undefined variable: $string Filename: libraries/file.php Line Number: 90 Of course if I define...

c# optimize returning a empty string

Possible Duplicate: In C#, should I use string.Empty or String.Empty or ? Is it better to return string.Empty; instead of return ""; What do you think? ...

Listbox datatemplate - item only selectable by clicking a subelement, not just anywhere on the item

I have a listbox with a datatemplate for the items. The problem is that selecting an item doesn't work by just clicking anywhere on the item; I have to click on a specific sub-element for it to actually work. My item has an image and a textblock. If I hover the mouse over the image or text-block, I actually see the hover-effect. If I ho...

What does this statement do: ();

I've seen perl statements that look like this: () unless $some_var; What is that intended to achieve? ...

Force download file with PHP giving empty file

The end goal is for the user to download a .csv file. Right now I'm just testing trying to download a simple text file: test.txt. The only thing in this file is the word "test". Here is the HTML code for files_to_download.php Test file: <a href='test.php?file=test.txt'>Test.txt</a> Code for test.php: if(!(empty($_GET["file"]))) { ...

Flex 3.4 and FMS 3.5.1 - Problem sending ByteArray on RTMP call

Hello, I installed a FMS 3.5 on my machine and created a new application with main.asc like this : application.onAppStart = function() { /* Allow debugging */ this.allowDebug = true; } //Client is connected application.onConnect = function( client ) { //Accept the connection application.acceptConnection( client ); ...

How to empty an javascript array?

var arr = [-3, -34, 1, 32, -100]; How can I remove all items and just leave an empty array? And is it a good idea to use this? arr = []; Thank you very much! ...

jQuery check empty field doesn't check all fields

For example, I'm using the script below to check for empty fields : $('a.submit').click(function() { if ($('.LoginData').val() == "") { $('input:text[value=""]').attr('style', 'border-color:#FF0000;'); } else { $(this).parents('form').submit(); } }); All the input elements have the class LoginData, so I used the jQuery class s...

Remove XML node when child node meets certain requirements

Hello all I have the following xml: <listaGiros> <giro> <idGiro type="int">89</idGiro> <nombreGiro type="varchar">foo</nombreGiro> </giro> <giro> <idGiro type="int">78</idGiro> <nombreGiro type="varchar">apple</nombreGiro> </giro> <giro> <idGiro type="int">10</idGiro> ...

Add an empty string vs toString - why is it bad?

According to the tool PMD, the following is a bad practice: String s = "" + 123; // bad String t = Integer.toString(456); // ok This is an inefficient way to convert any type to a `String`. Why is it a bad thing to do? ...

rails nils in a form

This is probably a simple question, but I noticed a few errors deriving from having empty values instead of nils... If a user leaves a field blank in a standard rails app is there a way to leave the field in the database set to NULL instead of entering an empty value? Basically so a check like @model.info.nil? return true instead of ha...

Determine whether a string is "empty"

I need a JavaScript function to tell me whether a string object is empty. By "empty", I mean that it's not all just whitespace characters. I've written this prototype: String.prototype.isEmpty = function() { return this.length === 0 || this === " " || this.test(/^\s*$/); } Is this alright? Is there a more-performant version of this...

Remove empty array elements

Some elements in my array are empty based on what the user has entered. I need to remove these elements. This is my code to do so: // Remove empty elements foreach($linksArray as $link) { if($links == '') { unset($link); } } print_r($linksArray); But it doesn't work, $linksArray still has empty elements. I have als...

boost::regex behaving differently on debug and release builds

boost::regex re("^\\s*([_\\w\\.]+)\\s*=\\s*([^\\s]+)$"); if(re.empty()){ std::cout<<"How is this possible?"<<std::endl; } That line prints in my release builds! (The debug builds are fine) Working with MSVC 2008 (vc 9.0) Compiler options for DEBUG: /Od /I "C:\Program Files\boost\boost_1_44_0" /I "C:\gtest-1.5.0\include" /I "includ...

how to turn off empty value approximation for Telerik chart controls

I am using the Telerik rad chart control to create a bar chart of date-based data. The x-axis shows the date for each data point. The y-axis shows some total. When there is no data in my datasource for a particular date, the chart is still showing a date, but no bar. I think this falls under the "empty series approximation" functionali...

jQuery tablesort and .empty() on ajax loaded table keeping rows

I am building a table with ajax and then attaching a jQuery tablesorter (found here). This works fine the first time. On a second time (and every one really) I empty out the rows like this: $('#tblTableName tbody tr').empty(); I then add the rows as I did before and then reattach the tablesorter. It looks fine and I show only the row...

DataTemplate a ViewModel with a NOT-Empty Constructor ?

Hello, how can I datatemplate a UserControl with a ViewModel with a NON-Empty constructor ? public PersonViewModel(Person person) { _person= person; // do some stuff } Binding this in Xaml will crash as the Ctor is not empty. But as I use parent/child relations with the ViewModels I have to p...

uploading empty file to ftp with psuedo-file

Hey all, As far as i know it is impossible to create an empty file with ftp, you have to create an empty file on the local drive, upload it, then delete it when you are done. I was wondering if it is possible to do something like: class FakeFile: def read(self): return '\x04' ftpinstance.storbinary('stor fe', FakeFile()) ...