i need write a select query to find the number of rows which have an empty fulltext field but for some reason both:
select count(id) from table where field is null;
and
select count(id) from table where field = "";
don't seem to work!
what else is there?!
My code does not update the thread field. It is null. Anyone have any ideas?
INSERT INTO [Messages]([Sender], [Receiver], [Job_Number], [Subject], [MessageText], [DateSent])
VALUES(@Sender, @Receiver, @Job_Number, @Subject, @MessageText, @DateSent)
SET @ThreadID = SCOPE_IDENTITY()
UPDATE [Messages]
SET Thread = @ThreadID
WHERE MessageID = @ThreadID
What are the methods to destroy object in C#, besides these:
object_instance = null;
System.GC.collect();
Please suggest only inbuilt techniques, not other tools like bigcannon, etc.
I have a file saved as UTF-8, and i'm reading it like this:
ReadFile(hFile, pContents, pFile->nFileSize, &dwRead, NULL);
(pContents is a BYTE* of size nFileSize)
its just a small file with 100 bytes or so, contains text which i want to read into memory in wchar_t* format, so i can set the text of edit and static controls with the unicode text.
How can i convert the bytes to UTF-8?
edit (i don't want to use fstream or wfstream)
Hi
asp.net mvc 2
I have this action in Identity controller
public ActionResult Details(string id, MessageUi message)
{
And I'm trying to redirect to this action from another controller, but I don't know how should I pass the message parameter
I was trying with
var id = "someidvalue"
var message = new MessageUi("somevalue");
return RedirectToAction("Details", "Identity", new { id, message});
}
but message parameter is null
I'm wondering if I'm going to store some data into the session is it going to be there while the user is authenticated (using formsauth) or might happen that the data will suddenly go null
How to declare a static dictionary object inside a static class? I tried
public static class ErrorCode
{
public const IDictionary<string , string > ErrorCodeDic
=new Dictionary<string, string>()
{
{"1","User name or password problem"}
};
}
But the compiler complains that "A const field of a reference type other than string can only be initialized with null".
I am having issues trying to get the pageControl sample code to work with rotation. I managed to get it to rotate but it does not visually load correctly until I start to scroll (then it works fine). Any Idea on how I can fix this problem? Here is a link to the project if you want to see it in action.
This code is based off the PageControl example apple has provided.
here is the code:
#import "ScrollingViewController.h"
#import "MyViewController.h"
@interface ScrollingViewController (PrivateMethods)
- (void)loadScrollViewWithPage:(int)page;
@end
@implementation ScrollingViewController
@synthesize scrollView;
@synthesize viewControllers;
- (void)viewDidLoad
{
amount = 5;
[super viewDidLoad];
[self setupPage];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload
{
[scrollView release];
}
- (void)dealloc
{
[super dealloc];
}
- (void)setupPage
{
NSMutableArray *controllers = [[NSMutableArray alloc] init];
for (unsigned i = 0; i < amount; i++) {
[controllers addObject:[NSNull null]];
}
self.viewControllers = controllers;
[controllers release];
// a page is the width of the scroll view
scrollView.pagingEnabled = YES;
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * amount, 200);
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.scrollsToTop = NO;
scrollView.delegate = self;
[self loadScrollViewWithPage:0];
[self loadScrollViewWithPage:1];
}
#pragma mark -
#pragma mark UIScrollViewDelegate stuff
- (void)scrollViewDidScroll:(UIScrollView *)_scrollView
{
if (pageControlIsChangingPage) {
return;
}
/*
* We switch page at 50% across
*/
CGFloat pageWidth = _scrollView.frame.size.width;
int dog = floor((_scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
// pageControl.currentPage = page;
[self loadScrollViewWithPage:dog - 1];
[self loadScrollViewWithPage:dog];
[self loadScrollViewWithPage:dog + 1];
}
- (void)loadScrollViewWithPage:(int)page
{
if (page < 0) return;
if (page >= amount) return;
MyViewController *controller = [viewControllers objectAtIndex:page];
if ((NSNull *)controller == [NSNull null]) {
controller = [[MyViewController alloc] initWithPageNumber:page];
[viewControllers replaceObjectAtIndex:page withObject:controller];
[controller release];
}
if (nil == controller.view.superview) {
CGRect frame = scrollView.frame;
frame.origin.x = frame.size.width * page;
frame.origin.y = 0;
controller.view.frame = frame;
[scrollView addSubview:controller.view];
}
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[self setupPage];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
}
@end
When i try to check Session["userId"] != null why i get this message Possible unintended reference comparrison; to get value comparrison; cast left hand side to string Any suggestion....
Hi All,
I am using <script> inside the body tag.
<script type="text/javascript" language="javascript">
$('#audioVolume').text($('#audioVolume').text(Math.round((document.mediaPlayer.Volume + 2000) / 10) + "%"));
</script>
Error: Microsoft JScript runtime error: 'undefined' is null or not an object.
Need: I want to access the html elements in <script inside the body tag.
I just started django and i want to access images uploaded by a user.
here is my model:
class Food(models.Model):
name = models.CharField(max_length=100)
price = models.DecimalField(max_digits=4, decimal_places=2)
quantity = models.IntegerField(blank=True, null=True)
description = models.CharField(max_length=200)
location = models.CharField(max_length=100)
time = models.DateTimeField()
photo_thumbnail = models.ImageField(upload_to="images")
photo_fullsize = models.ImageField(upload_to="images")
i stored the image in the "images" folder below
the html is this:
img src="{{steak.photo_thumbnail}}"
and
steak.photo_thumbnail = images/steak_and_egg_thumbnail_1.png
here is the error i get:
[06/Jul/2012 19:08:24] "GET /menu/ HTTP/1.1" 200 99
[06/Jul/2012 19:08:24] "GET /menu/images/steak_and_egg_thumbnail_1.png HTTP/1.1" 404 2127
I am trying to have a loop continue to prompt the user for an option. When I get a string of characters instead of an int, the program loops indefinitely. I have tried setting the variable result to NULL, clearing the input stream, and have enclosed in try{}catch blocks (not in this example). Can anyone explain to me why this is?
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int menu(string question, vector<string> options)
{
int result;
cout << question << endl;
for(int i = 0; i < options.size(); i++)
{
cout << '[' << i << ']' << options[i] << endl;
}
bool ans = false;
do
{
cin >> result;
cin.ignore(1000, 10);
if (result < options.size() )
{
ans = true;
}
else
{
cout << "You must enter a valid option." << endl;
result = NULL;
ans = false;
}
}
while(!ans);
return result;
}
int main()
{
string menuQuestion = "Welcome to my game. What would you like to do?";
vector<string> mainMenu;
mainMenu.push_back("Play Game");
mainMenu.push_back("Load Game");
mainMenu.push_back("About");
mainMenu.push_back("Exit");
int result = menu(menuQuestion, mainMenu);
cout << "You entered: " << result << endl;
return 0;
}
While executing the following code i gets this error "Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true."
class Program
{
static void Main(string[] args)
{
MethodInfo MI = typeof(MyClass).GetMethod("TestProc");
MI.MakeGenericMethod(new [] {typeof(string)});
MI.Invoke(null, new [] {"Hello"});
}
}
class MyClass
{
public static void TestProc<T>(T prefix)
{
Console.WriteLine("Hello");
}
}
Please help.
Sorry to keep hammering on this, but I'm trying to learn :). Is this any good? And yes, I care about memory leaks. I can't find a decent way of preallocating the char*, because there simply seems to be no cross-platform way.
const string getcwd()
{
char* a_cwd = getcwd(NULL,0);
string s_cwd(a_cwd);
free(a_cwd);
return s_cwd;
}
What's going on when the assignment statement executed at Line 4, does compiler ignore the new operator and keep the foo variable being null or something else happen to handle this awkward moment?
public class Foo {
// creating an instance before its constructor has been invoked, suppose the "initializing"
// gets printed in constructor as a result of the next line, of course it will not print it
private Foo foo = new Foo();//Line 4
public Foo() {
System.out.println("initializing");
}
}
On the client I have setup the bus with ImpersonateSender(true)
My server is configured AsA_Server, which by default should have ImpersonateSender(true)
I'm now trying to retrieve the WindowsIdentity, from inside a Handler
var windowsIdentity = WindowsIdentity.GetCurrent(true);
But this is giving me null.
What am I doing wrong?
hi
i have a simple question
where is my code wrong ?
in index controller and index action
i put
$this->view->username="user1";
and when i try in my layout i use
echo $this->username;
i got fllowing error or null value
Notice: Trying to get property of non-object in D:\Zend\Apache2\htdocs\test\application\layouts\layout.phtml on line 115
thanks
Hello, I have situation where I have to call method of interface using reflection, like this
object x = null;
MethodInfo method = interfaceExists.GetMethod("ShutDown");
method.Invoke(x, new object[] { 4 })
As you can see I do not create instance of object! And, as I can supposed, I receive exception
Non-static method requires a target
And Question, Can I call method of interface using reflection without creating instance of interface and if YES, How I can do it ?
Thank you.
I'm having problem with some data missing in the record. I've a ASP.net web app that take some information from the user then create a record on the database. It's your typical CRUD app but I've noticed lately that some record are missing couple fields. Where they are null value. I think it might have been an Session issue.
What's the best way to handle session time out in a typical CRUD app?
Thanks
What is the best way of inserting a datetime value using a dynamic sql string, whilst at the same time being able to handle the possibility of the value being null?
The current statement inserts into a table from a select statement built using a string. The datetime value is stored in a parameter and the parameter is used in the select.
Like so:
set @execsql = 'Insert into ( start_date )
SELECT ( ''' + CAST(start_date as VARCHAR) + ''' + ')'
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
if(petDetails.getDateOfDeath() != null){
String formatedDateOfDeath = formatter.format(petDetails.getDateOfDeath());
String formateDateOfBirth = formatter.format(petDetails.getDateOfBirth());
}
How can i calculate the age of death from the above. I dont want to use any externallibraries
EDIT: please look at what I've got so far.none of the other threads are like mine. most of them are about date from DOB to today and not in the format im using.
hi ,
i am using clientlogin api for google finance application .
now i need ti implement the logout functionality.
is there any api for logout .. how to implement it?
or we simply need to invalidate token by setting it to null?
thanks
I need a big null array in C as a global. Is there any way to do this besides typing out
char ZEROARRAY[1024] = {0, 0, 0, /* ... 1021 more times... */ };
?