C# :: Session Is Null But Not Null?

Mar 31, 2015

When you login to my site my loginservice which is done by ajax and json make a session called context.Session["Name"]. With BreakPoints it shows that everything is good and the variables are in place. However when I use Session["Name"] it comes out as null.

I will add my code at the bottem not

using System;
using System.Collections.Generic;
using System.Linq;

[Code].....

View 2 Replies


ADVERTISEMENT

C++ :: Null Terminator Same As Null And Through False Value?

Feb 18, 2014

I am looking at one of the functions of an exercise:

void escape(char * s, char * t) {
int i, j;
i = j = 0;
while ( t[i] ) {
/* Translate the special character, if we have one */
switch( t[i] ) {

[code]...

Notice the while loop evaluates the current value in t to true or false. When we hit the null terminator, does that get evaluated as 0 and hence evaluates as a falsy value so the while loop exits?

View 1 Replies View Related

C :: Getting Null Pointers In Most Of Functions

Oct 15, 2014

For some reason I keep getting null pointers in most of my functions, and in my convertTime function the numbers are way higher than they should be.

Code:

//Utils.H header file----------------------------------------------

//This function takes the radius of a circle and returns the diameter, the circumference and the area.
int circleStatistics(double radius, double *diameter, double *circumference, double *area);

//This function takes a number of days and returns how many years, weeks and remaining days that is.
int convertTime(int days, int *y, int *w, int *d);

//This function takes a length of time and calculates the dilation of that time at a percentage of the speed of light.
int lorentzTimeDilation(double normalTime, double percentC, double *dilatedTime);

[Code] ....

View 3 Replies View Related

C++ :: Pointing To NULL And 0 The Same Thing?

Apr 13, 2014

Is:

char *endp = NULL;

the same thing as:

char *endp = 0;

?

View 1 Replies View Related

C++ :: Using STRTOK With Null Fields?

Jul 23, 2013

I am beginner in C++ programming. And i was try use STRTOK code with NULL fields, but in ARRAY fields NULL values is skiped. For example:

input text in Memo2:

AnsiString PAT02[100][20];
for (int IndexVRadku02 = 0; IndexVRadku02 < Memo2->Lines->Count ; IndexVRadku02++) {
AnsiString PNF02 = Memo2->Lines->Strings[IndexVRadku02];
char * PN02;

[Code] ....

Result:

Array 00 01 02 03 04 05
00 0000 TEXT1 TEXT2
01 0002 TEXT3 TEXT4 TEXT5
02 0003 TEXT6

But i need this result:

Array 00 01 02 03 04 05
00 0000 TEXT1 TEXT2
01 0002 TEXT3 TEXT4 TEXT5
02 0003 TEXT6

View 2 Replies View Related

C++ :: Point Of NULL In CString

Jul 9, 2014

I dont see any point of NULL in cstring. The code given below just outputs same as it would have done with NULL. My understanding is if size of char array is less than length of char array then null must be manually added?

#include <iostream>
using namespace std;
int main(){
char chr[0];
cin>>chr;//or if you use cin.getline;
cout<<chr<<endl;
return 0;
}

Enter something: hellowwwww
hellowwwww
Segmentation fault (core dumped)

why? for NULL char or something else?

View 1 Replies View Related

C++ :: Pointer As Parameter Is Null?

Apr 9, 2014

In my raytracer-project I have the following function:

bool hitObjects(Ray &ray, std::vector<Object *> &objects, Vector3& normal, Material *mat) {
double tmin = K_HUGE_VALUE;
double t;

[Code]....

When I try to run this, I only get the message "Material pointer is null". So, somehow the pointer is null after the hitObjects-function is called, even though it isn't inside that function.

View 6 Replies View Related

C/C++ :: MySQL - Resultset Is Always Null

Jul 30, 2014

The resultset is always null and the connection is alive. The VS2013 debugger says that mysqlcppconn.dll has no debugging symbols. Tested the query on a mysql console and it worked fine, it returned 1.

CDatabase::CDatabase(CSettings* settings) {
settings = settings;
try {
Connection* con = get_driver_instance()->connect("", "", "");
con->setSchema("hyperbot");
cout << "Connected." << endl << endl;

[Code] .....

I also get these strange warnings on compile:

1>c:program files (x86)mysqlmysql connector c++ 1.1.3includecppconnsqlstring.h(38):
warning C4251: 'sql::SQLString::realStr' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
needs to have dll-interface to be used by clients of class 'sql::SQLString'

[Code] ......

View 10 Replies View Related

C/C++ :: Strtok And Null Checking?

Mar 1, 2015

I'm playing around with parts of code and am coming across some errors. Most of my concern is related to strtok(). I've used it before but with a char* named token. I used a while loop to continuously check whether token was equal to NULL. In the following code, however, there aren't any checks. I was wondering if that is why this code prints (null) while running. Also, I would like to know if it is possible to read input like this code attempts to do - assigning tokens to each variable one after the other.

The format of the input:

Zucchini, Squash, pound
Yellow, Squash, pound
Tomatoes, Ugly Ripe, each
#include <stdio.h>
#include <stdlib.h>

[code]....

View 3 Replies View Related

C/C++ :: Initializing Pointer To NULL?

May 17, 2014

So I'm writing a small program for class, and for some reason I keep getting an error when trying to initialize head to NULL. Even threw in the namespace just to see, nothin'.

#ifndef NUMBERLIST_H
#define NUMBERLIST_H
using namespace std;

[Code].....

There's my header file. Not sure what I'm doing wrong with the constructor.

EDIT: Got it to work with nullptr, but still curious why that isn't working

View 2 Replies View Related

C# :: Linq To SQL With Null Value In WHERE Clause

Apr 13, 2015

I am trying to query fields in a where clause using LINQ to SQL and for some reason I cannot figure out why it doesn't work:

var qryGetMonsterID = (from students in dbContext.tblStudentPersonals
where (students.givenname.Equals(fn)) && (students.familyname.Equals(ln)) && (students.middlename.Equals(mn)) && (students.email.Equals(e))
select students);

The returned SQL Syntax is:

SELECT [t0].[monsterid], [t0].[givenname], [t0].[middlename], [t0].[familyname], [t0].[homeaddress], [t0].[city], [t0].[state], [t0].[postal], [t0].[primaryphone], [t0].[secondaryphone], [t0].[email], [t0].[username], [t0].[lastmodified], [t0].[modifiedby]
FROM [dbo].[tblStudentPersonal] AS [t0]
WHERE ([t0].[givenname] = @p0) AND ([t0].[familyname] = @p1) AND ([t0].[middlename] = @p2) AND ([t0].[email] = @p3)

Not sure but the values for middle name could be null - because not everyone has a middle name and the same is true for e-mail.

View 6 Replies View Related

C# :: Need To Replace Null Value By 0 To Calculate

Jun 28, 2014

I have a datagridview (dgv) that is bound to database:

QtyOnHand QtyOnHold QtySold QtyAvailable
10 2 1 null
12 null null null
null null null null
7 5 null null
25 null 5 null

I want to iterate through the datagridview and calculate the last column with this formula:

QtyAvailable = QtyOnHand - QtyOnHold - QtySold

so the datagridview should become:

QtyOnHand QtyOnHold QtySold QtyAvailable
10 2 1 7
12 null null 12
null null null null
7 5 null 2
25 null 5 20

I use this code:

foreach (DataGridViewRow row in dgv.Rows){
if (string.IsNullOrEmpty(row.Cells["QtyOnHand"].Value.ToString())){
row.Cells["QtyAvailable"].Value =
Convert.ToInt32(row.Cells["QtyOnHand"].Value) -
Convert.ToInt32(row.Cells["QtyOnHold"].Value) -
Convert.ToInt32(row.Cells["QtySold"].Value) -
Convert.ToInt32(row.Cells["QtyAvailable"].Value);
}
}

The problem is when any of the value on the right side of the equation is null, the whole equation is invalid. I need to replace the null values by 0 on the fly so that it can be calculated. Note that I do not want to actually replace the null values in the second and third columns of the table, just replace it in the equation whenever it applies to make the calculation work.

View 4 Replies View Related

C++ :: Create Null Pointer After Using Delete

Aug 7, 2014

In jumping into C++ it says something like this: It's not necessary but when you delete a pointer it's a good idea to reset it as a null pointer. That if your code try's to dereference the pointer after being freed, your program will crash. This happens to a lot of experienced programmers.

This could corrupt users data. delete p_int;
p_int = NULL;

1. If you can deference a pointer after the memory is freed, why can't you just delete the pointer?

2. If you can do 1, how do you delete the pointer using code?

3. Every thing I've read says that free memory is handed out in a sequenced order. I don't believe that is true at all. I may be wrong. Why can't you put the data in any number of places if it will fit. Isn't the compiler smart enough to know where bytes (bits)and pieces are stored?

4. If you storing anything in free memory must use a pointer to it?

5. Can a pointer or something similar be used with stack memory?

View 13 Replies View Related

C :: Simple Program / Null Terminator

Aug 1, 2013

my program is printing out a random symbol afterwards , when trying to copy a sequence of chars into a new buffer.

Code:

#include <stdio.h>#include <stdlib.h>
int tokenCopy(char* dest, const char* src, int destSize);
int main() {
char buff[3];
int n = tokenCopy(buff, "This is a string", 3);
printf("%d '%s'
", n, buff);

[code]....

View 2 Replies View Related

C# :: Getting Instance Object Is Null Compile

Dec 2, 2011

Code:

public class ColorGenetics
{
public static hk1Class jw;
public static linkedClass link;
}

[code]...

Code builds fine but compiler says I tried to use bject link w/o providing an instance. Class linkedClass has an instance of Class hk1Class set to var jw1.I had linkedClass useing the same var jw for the object instance. I changed it to jw1 thinking that would clear it up and it didn't.

View 2 Replies View Related

C++ :: Null Statement - Prevent Optimization

Dec 7, 2014

Recently I was looking into embedded programing of AVR microcontrollers.

At this site [URL] ....

I have encounter some code that implements delay

asm volatile ("nop");

From what I understand it is assembler code that creates delay - one processor clock long.

For C/C++ language it should be like ; or {} = null statement.

Now my question is how to implement this C/C++ code and prevent my compiler (WinAVR: AVR-GCC) to delete this command during optimization (-Os or -O2). Or is it simply better to use the assembler function.

I know I can use for-loop

volatile uint8_t foo
for(foo=0; foo<2; ++foo){}

but for that I have to create a variable = wasting 1 byte of RAM; correct?

View 11 Replies View Related

C++ :: Pointer Pointing To Null Still Executing

Dec 9, 2013

in the below program for both class pointers pointing to null. Class contains normal function executing but class contains virtual function getting segmentation fault.

#include <cstdio>
using namespace std;
class A
{

[Code].....

View 1 Replies View Related

C++ :: Null Root Binary Tree

May 19, 2013

I got problem in binary tree code. below is my code. When i select pre, post or inorder, the .exe is not responding.. Since in my binary tree theres no roots yet.. who do i solve it? It need condition or what?

View 1 Replies View Related

C++ :: Object Inside Class Becomes NULL?

Nov 18, 2013

I have built LOG4CXX lib and DLL and trying to use it in my application

Loh.h
class Log
{
public:

[Code].....

In my main I am initializing Log class object and calling Debug method to log debug message to a file.

Issue I am facing is at if(CLogger::oLogger != NULL) which is always returning oLogger as NULL.

View 1 Replies View Related

C++ :: Setting Entire Array To NULL

Dec 12, 2013

Okay so I've declared an array like this.

Foo *Blocks[100][100][10000] = {0};

And as far as my understanding goes This creates an array with every member set to NULL.

And then later on in my code some of these get given values using:

Blocks[a][b][c] = new Foo;

And then when I want to unload I would think that I could just go

Blocks = {0};

But obviously this doesn't work.

So I was wondering if there was a way of doing This, with out creating a loop and changing every one to NULL manually.

View 8 Replies View Related

C# :: While Statement Not Recognizing Non-null String

Oct 10, 2014

The List[] array contains some empty entries but most are filled, yet every time I run this routine the variable Index makes it to the end of the array. I've tried many different routes and can't seem to figure out this simple issue.

string Result = string.Empty;
while ((Index < (List.Length - 1)) || !string.IsNullOrEmpty(Result))
{
Result = List[Index];
Index++;
}
return Result;

View 9 Replies View Related

C/C++ :: Null Terminated String Function

Feb 12, 2015

how would I write a function that copies a null-terminated string from one char* buffer to another, without using strcpy? I am trying to avoid strcpy because of the null terminator.

Here is my attempt;

#include <algorithm>
#include <iostream>
static const size_t, data_size =32;
struct tString
{
char data[data_size];
};
std::string buffer = strArray1[0] + strArray2[0];
std::copy(buffer.begin(), buffer.end(), tString[0].data);

View 8 Replies View Related

C# :: Null Reference With Connection String

Nov 29, 2014

private DataSet1 GetData(string query) {
string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;

The above is erring out with NullReferenceException

View 6 Replies View Related

C/C++ :: How To Null Terminate Unsigned Short

Jul 23, 2014

I've stored a binary pattern in what is interpreted as an unsigned short.

unsigned short byte_one = 128;

I've done some bitwise manipulation and want to store it back into an array, however, it needs to be null-terminated.

buf[1] = byte_one;

How do I null-terminate this?

View 3 Replies View Related

C++ :: Writing Data To A File - ETX Null

Aug 19, 2013

I am trying to write one data to my file(myfile.#abc).

Code:
FILE * pFile;
int iLast Col=3;
fopen_s (&pFile,_T("myfile.#abc"), "w+");
fwrite ((char *)&iLastCol,1,2,pFile);
fclose (pFile);

Inside file ia getting a value like this

[ETX][NULL]

What is mean by ETX,Like that some other variable I amgetting [SUB],[STX]etc.what is this?

View 1 Replies View Related

C++ :: Initializing Vector Of Objects With NULL

Feb 27, 2014

class A; //forward defined in class B.h
class B
{
private:

[Code]....

I get error message forward Declaration of class A;

What is going on here. Is there a way I could initialize all the vectors of type B to be set to NULL in the constructor?

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved