What's the best way of writing robust code so that a variable can be checked for null and blank.
e.g.
string a;
if((a != null) && (a.Length() > 0))
{
//do some thing with a
}
My OCSP client is sending me the following HTTP request:
POST <NULL> HTTP/1.0
Content-Type: application/ocsp-request
Content-Length: 120
The NULL is not mentioned in the RFC for HTTP 1.0. Does that make this a malformed request?
I'm using the following code to hide stderr on Linux/OSX for a Python library I do not control that writes to stderr by default:
f = open("/dev/null","w")
zookeeper.set_log_stream(f)
Is there an easy cross platform alternative to /dev/null? Ideally it would not consume memory since this is a long running process.
I have the following structure in a Java Web Application:
TheProject
-- [Web Pages]
-- -- [WEB-INF]
-- -- -- abc.txt
-- -- index.jsp
-- [Source Packages]
-- -- [wservices]
-- -- -- WS.java
In WS.java, I am using the following code in a Web Method:
InputStream fstream = this.getClass().getResourceAsStream("abc.txt");
But it is always returning a null. I need to read from that file, and I read that if you put the files in WEB-INF, you can access them with getResourceAsStream, yet the method is always returning a null.
Any ideas of what I may be doing wrong?
can someone please help me with this javascript:void(null)
I found it used in link buttons as follows
<a onclick="ProcessResponse()" href="javascript:void(null)" >Accept Data</a>
Hi,
Is there any function to replace the special characters by null in informatica
if we used replacestr function, i think we should specify all special characters
as follows replacestr(input,'!','~','@','#','$','%','^','&','*',null)
But we dont know what are teh special characters will be coming as input.
can u please let me know that which function will be suitable.
I have a model called user which has_one email. I put the foreign key (NOT NULL) inside users table.
Now I'm trying to save it in the following way:
@email = Email.new(params[:email])
@email.user = User.new(params[:user])
@email.save
This raises a db exception, because the foreign key constraint is not met (NULL is inserted into email_id). How can I elegantly solve this or is my data modeling wrong?
Good Morning,
Say I have an insert statement:
Insert INTO tblTest (fieldOne,FieldTwo,fieldThree) VALUES ('valueOne','valueTwo','null')
This statement doesn't seem to want to insert a null value into the database... I have also tried to insert the word "nothing".
Has anyone any ideas how to make this work? I am using SQL server 2005.
In my project I observed that in a FormClosed method (that handles FormClosed event)
is set MdiParent = Nothing (null).
This code makes (? no idea why) that OnLoad(method) on some child panels is raised.
Is there any sense to set MdiParent to null (Nothing) in FormClosed?
I have a simple problem, I think, but I have googled and can't find the solution. I have a cube that has MeasureA, MeasureB and MeasureC. Not all three measures have values for each record, sometimes they can be null, it's depending if it was applicable.
Now for my totals, I need to average but the average must not take nulls into account. Any help will be much appreciated. When I view the measures, the null values show as zeros.
I've set up a view which combines all the data across several tables. Is there a way to write this so that only columns which contain non-null data are displayed, and those columns which contain all NULL values are not included?
When running a groovy script from Eclipse, the following line:
def rootLoader = this.class.getClassLoader().getRootLoader()
is null. When I run the script directly from command line, this is not null. How can I find out why this happens?
Dunno why it is...heres the coding for it.
http://pastebin.org/301343
I know theres a lot of repetitiveness in the coding...but its because the arrays were retuning null so I got tired of messing with them.
Everything works until it reaches line 224, which returns null values.
Is it a good practice to set stream references to null after closing them? Would this release resources in any way?
Example:
BufferedReader input= new BufferedReader(new FileReader("myfile.txt"));
// code
input.close();
input = null;
// possible more code
How can I validate a String null or empty using the c tags of JSLT.
I have a variable of name var1 and I can display it, but I want to add a comparator for validate it.
I want to validate when is different of null or empty (my values are string).
Which approach is better to use:
BoundField.NullDisplayText isn't set. NULL-case is foreseen in SQL query, i.e. SELECT ISNULL(amount, 0) FROM table
or
BoundField.NullDisplayText is set, e.g. "0.00 %". NULL-case isn't foreseen in SQL query, i.e. SELECT amount FROM table
What do you think?
I have seen people using the following conditions interchangeably.
String name;
//some code
if(name != null)
//or if(null != name)
So is there any difference in this? or both are same?
I am asking this here because, i heard that there is some difference in these, but don't know what.
Thanks
Hi
I have asked this question before in this forum and they told me that it will retun an empty result set,I want to know that if I set the column with null values it will retun an empty result set?also the ANSI_NULLS is OFF ,thanks
SELECT 'A' FROM T WHERE A = NULL;
char *p,*p1,*p2,*p3,*p4;
for(;;)
{
if((p=malloc(10))!=NULL && (p1=malloc(20))!=NULL ......)
break;
}
Writing if(........) is too boring and long, are there any ways to make it simpler?
We run a project, which we want to solve with test driven development. I thought about some questions that came up, when initiating the project. One question was, who should write the unit-test for a feature. Should the unit-test be written by the feature-implementing programmer? Or should the unit test be written by another programmer, who defines what a method should do and the feature-implementing programmer implements the method until the tests runs?
If i understand the concept of TDD in the right way. The feature-implementing programmer has to write the test by himself, because TDD is procedure with mini-iterations. So it would be too complex to have the tests written by another programmer?
What would you say, should the tests in TDD written by the programmer himself or should another programmer write the tests that describes what a method can do?
I want to build a test system in the office. On one box I will install XAMPP. I will put a website that I want to test on that box. Now I do not want it connected to the Internet. So my plan is to use a reverse proxy to resolve things like ads and other external links. So I am thinking of using mod_proxy for that. Now my question is, How many boxes do I need?
1 for Xampp, 1 for mod_proxy and 1 for the server where mod proxy redirects them to. Total of three. But maybe I could do it with less. Can I run Mod_proxy on the first box? Is there a better way?
Thanks
Hi All,
I am very new to the VMware world. We have VMWare vCenter 4 in the production environment but we have created multiple VLAN through Cisco Switch. I want know, how I can create an isolated test environment for software testing purpose only, so anything will happen in that test vLan will not make trouble in the production environment.
"Host-only networking" is the solution or there is a better way to achieve this result?
My requirements
A. Hosts should be able to access Internet and a Network Share drive but not Production network
B. Hosts should connect each other inside the Virtual LAN
C. I should be able to take automatic or periodic backup or snapshoot and deploy snapshot when necessary.
Whatever your answer is, please give me steps, how to do, if possible.
If I need to purchase anything, I am ready to do but I don't want to spend big money.
Many thanks in advance.