empty

PHP if statement issue when checking for variable value

I'm trying to just write a simple PHP if statement that checks if a custom field has anything entered into or if it has been left blank. when it is blank it is meant to not print anything to the page, if something is set in the custom field then it should create a li element with an a tag inside of it. here is my code so far: <ul clas...

Oracle group by and the empty resulting set

Hi! I have the following SQL problem. Scenario: I have two tables: Change and ChangeTicket. There is a 1:n relationship. One Change has cero or many changeTickets. No change means no changeTickets. A changeTicket has a status (open/closed/...) A changeTicket has a field representing how many minutes took this change. A Change has a co...

Faster means of checking for an empty buffer in C?

By 'empty buffer,' I mean a buffer full of zeroes. I am searching for a faster method of accomplishing this: int is_empty(char * buf, int size) { int i; for(i = 0; i < size; i++) { if(buf[i] != 0) return 0; } return 1; } I realize I am searching micro optimization unnecessary except in extreme cases, but I know a faster method ...

How can I check if an InputStream is empty without reading from it?

I want to know if an InputStreamn is empty, but without using the methods read(). Is there a way to know if it's empty without reading from it? ...

How to check if mysql entry is empty in PhP?

Hello, here is the description variable I am echoing from my table: $description = mysql_result($result,$i,"description"); sometimes the $i'th record is empty and doesn't have any data in it/no description. What I want to do is echo "No description available" for records that are empty if (isset($description)){ echo "No description ...

Python: How to check if a nested list is essentially empty?

Is there a Pythonic way to check if a list (a nested list with elements & lists) is essentially empty? What I mean by empty here is that the list might have elements, but those are also empty lists. The Pythonic way to check an empty list works only on a flat list: alist = [] if not alist: print("Empty list!") For example, all th...

Grails, getting InputStream from Controller (or even Servlet)

I'm trying to get inputStream from request, but it's always empty. Any idea how to get the contents of it? I'm trying to make a DataInputStream from it. ...

php: check if certain item in an array is empty

In PHP, how would one check to see if a specified item (by name, I think - number would probably also work) in an array is empty? ...

Why must I assign the result of PHP's end() array function to a variable to operate on the result?

I've tried to delete the possibly empty last entry of an array as follows but I get the error: "Can't use function return value in write context": if (empty(end($crontabEntryList))) { array_pop($crontabEntryList); } If I first assign end's return value to a variable (as at the bottom) I am able to delete that last entry if emp...

.NET MVC custom routing with empty parameters

Hi All, I have a .net mvc with the following routes: routes.Add(new Route( "Lookups/{searchtype}/{inputtype}/{firstname}/{middlename}/{lastname}/{city}/{state}/{address}", new RouteValueDictionary( new { controller = "Lookups", action = "Search", firstname = (string)null, middlename = (string)null, lastname = (...

Java Remove empty XML tags

I'm looking for a simple Java snippet to remove empty tags from a (any) XML structure <xml> <field1>bla</field1> <field2></field2> <field3/> <structure1> <field4>bla</field4> <field5></field5> <structure1> </xml> should turn into; <xml> <field1>bla</field1> <structure1> <field4>bla</fi...

How to create an empty file at the command line?

How to create an empty file at the DOS/Windows command-line? I tried: copy nul > file.txt but it always displays that a file was copied. Is there any other method in the standard cmd? It should be a method that does not require the touch command from Cygwin or any other nonstandard commands. The command needs to run from a script s...

How to check if a list is empty in Python?

The API I'm working with can return empty [] lists. What isn't working: if myList is not None: #not working if myList is not []: #not working What will work? ...

Android empty list layout

Android empty list layout Whatever I do, I can't get the empty tag to display. Inside my tabs, I've got: <LinearLayout android:id="@+id/thisParticularTab" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id="@+id/LastUpdated" android:layout_width="fill_parent" a...

PHP return empty json string

My html page sends an ajax request (POST) to PHP, PHP echo a json object. Code has been tested and worked fine at my development view. However, after they are uploaded to a VPS hosting server, the returned json string is empty (I used alert() at the response function to display the responseText and found out it was empty). Could som...

How to append DOM Element into an empty element in JavaScript?

I have bunch of objects that return a DOM-tree that I then use to append to an element. For example, var elem = document.createElement('div'); elem.appendChild(callSomePrototypesMethod()); elem.appendChild(callSomePrototypesMethod()); elem.appendChild(callSomePrototypesMethod()); and I will eventually end up in something like: <div> ...

How to Pass Dummy jQuery Object to Javascript function

Hello all, I have a javascript function that, in most cases, needs to do something with a jQuery object that I pass it. There is a single exception where the function will not need a jQuery object, but because I've written it to accept a string (the command) and a jQuery object, I need something to pass it when I call it. My function is...

what is the capacity of an empty vector?

Looks like a stupid question. But comment to my answer to one of the SO question made me to think again. [ comment says, capacity need not be zero for empty vector] By default my answer would be 0 as there are no elements inside vector. It makes sense to keep the capacity as 0 and on the first allocation it can be increased without an...

Best way to check if a character array is empty

Which is the most reliable way to check if a character array is empty? char text[50]; if(strlen(text) == 0) {} or if(text[0] == '\0') {} or do i need to do memset(text, 0, sizeof(text)); if(strlen(text) == 0) {} Whats the most efficient way to go about this? ...

Is it possible to display a message or default row in a Silverlight 3 Datagrid

I have a DataGrid which is bound to a PagedCollectionView and the underlying collection may contain no items. When this occurs the DataGrid does not render at all, no column headers or anything, and when the DataGrid is then re-bound to another PagedCollectionView that does contain some items it causes a system error System.ArgumentE...