Search Results

Search found 7914 results on 317 pages for 'valid xhtml'.

Page 49/317 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • 'System.Windows.Data.MultiBinding' is not a valid value for property 'Text'.

    - by chaiguy
    I'm trying to write a custom MarkupExtension that allows me to use my own mechanisms for defining a binding, however when I attempt to return a MultiBinding from my MarkupExtension I get the above exception. I have: <TextBlock Text="{my:CustomMarkup ...}" /> CustomMarkup returns a MultiBinding, but apparently Text doesn't like being set to a MultiBinding. How come it works when I say: <TextBlock> <TextBlock.Text> <MultiBinding ... /> </TextBlock.Text> </TextBlock> But it doesn't work the way I'm doing it?

    Read the article

  • Why does this valid Tkinter code crash when mixed with a bit of PyWin32?

    - by Erlog
    So I'm making a very small program for personal use in tkinter, and I've run into a really strange wall. I'm mixing tkinter with the pywin32 bindings because I really hate everything to do with the syntax and naming conventions of pywin32, and it feels like tkinter gets more done with far less code. The strangeness is happening in the transition between the pywin32 clipboard watching and my program's reaction to it in tkinter. My window and all its controls are being handled in tkinter. The pywin32 bindings are doing clipboard watching and clipboard access when the clipboard changes. From what I've gathered about the way the clipboard watching pieces of pywin32 work, you can make it work with anything you want as long as you provide pywin32 with the hwnd value of your window. I'm doing that part, and it works when the program first starts. It just doesn't seem to work when the clipboard changes. When the program launches, it grabs the clipboard and puts it into the search box and edit box just fine. When the clipboard is modified, the event I want to fire off is firing off...except that event that totally worked before when the program launched is now causing a weird hang instead of doing what it's supposed to do. I can print the clipboard contents to stdout all I want if the clipboard changes, but not put that same data into a tkinter widget. It only hangs like that if it starts to interact with any of my tkinter widgets after being fired off by a clipboard change notification. It feels like there's some pywin32 etiquette I've missed in adapting the clipboard-watching sample code I was using over to my tkinter-using program. Tkinter apparently doesn't like to produce stack traces or error messages, and I can't really even begin to know what to look for trying to debug it with pdb. Here's the code: #coding: utf-8 #Clipboard watching cribbed from ## {{{ http://code.activestate.com/recipes/355593/ (r1) import pdb from Tkinter import * import win32clipboard import win32api import win32gui import win32con import win32clipboard def force_unicode(object, encoding="utf-8"): if isinstance(object, basestring) and not isinstance(object, unicode): object = unicode(object, encoding) return object class Application(Frame): def __init__(self, master=None): self.master = master Frame.__init__(self, master) self.pack() self.createWidgets() self.hwnd = self.winfo_id() self.nextWnd = None self.first = True self.oldWndProc = win32gui.SetWindowLong(self.hwnd, win32con.GWL_WNDPROC, self.MyWndProc) try: self.nextWnd = win32clipboard.SetClipboardViewer(self.hwnd) except win32api.error: if win32api.GetLastError () == 0: # information that there is no other window in chain pass else: raise self.update_search_box() self.word_search() def word_search(self): #pdb.set_trace() term = self.searchbox.get() self.resultsbox.insert(END, term) def update_search_box(self): clipboardtext = "" if win32clipboard.IsClipboardFormatAvailable(win32clipboard.CF_TEXT): win32clipboard.OpenClipboard() clipboardtext = win32clipboard.GetClipboardData() win32clipboard.CloseClipboard() if clipboardtext != "": self.searchbox.delete(0,END) clipboardtext = force_unicode(clipboardtext) self.searchbox.insert(0, clipboardtext) def createWidgets(self): self.button = Button(self) self.button["text"] = "Search" self.button["command"] = self.word_search self.searchbox = Entry(self) self.resultsbox = Text(self) #Pack everything down here for "easy" layout changes later self.searchbox.pack() self.button.pack() self.resultsbox.pack() def MyWndProc (self, hWnd, msg, wParam, lParam): if msg == win32con.WM_CHANGECBCHAIN: self.OnChangeCBChain(msg, wParam, lParam) elif msg == win32con.WM_DRAWCLIPBOARD: self.OnDrawClipboard(msg, wParam, lParam) # Restore the old WndProc. Notice the use of win32api # instead of win32gui here. This is to avoid an error due to # not passing a callable object. if msg == win32con.WM_DESTROY: if self.nextWnd: win32clipboard.ChangeClipboardChain (self.hwnd, self.nextWnd) else: win32clipboard.ChangeClipboardChain (self.hwnd, 0) win32api.SetWindowLong(self.hwnd, win32con.GWL_WNDPROC, self.oldWndProc) # Pass all messages (in this case, yours may be different) on # to the original WndProc return win32gui.CallWindowProc(self.oldWndProc, hWnd, msg, wParam, lParam) def OnChangeCBChain (self, msg, wParam, lParam): if self.nextWnd == wParam: # repair the chain self.nextWnd = lParam if self.nextWnd: # pass the message to the next window in chain win32api.SendMessage (self.nextWnd, msg, wParam, lParam) def OnDrawClipboard (self, msg, wParam, lParam): if self.first: self.first = False else: #print "changed" self.word_search() #self.word_search() if self.nextWnd: # pass the message to the next window in chain win32api.SendMessage(self.nextWnd, msg, wParam, lParam) if __name__ == "__main__": root = Tk() app = Application(master=root) app.mainloop() root.destroy()

    Read the article

  • ASP.NET MVC Page - Viewstate for Confirm email field is getting erased on Registration Page if valid

    - by Rita
    Hi I have a Registaration page with the following fields Email, Confirm Email, Password and Confrim Password. On Register Button click and post the model to the server, the Model validates and if that Email is already Registered, it displays the Validation Error Message "User already Exists. Please Login or Register with a different email ID". While we are displaying this validation error message, I am loosing the value of "Confirm Email" field. So that the user has to reenter again and I want to avoid this. Here I don't have confirm_Email field in my Model. Is there something special that has to be done to remain Confirm Email value on the Page even in case of Validation failure? Appreciate your responses. Here is my Code: <% using (Html.BeginForm()) {%> <%= Html.ValidationSummary(false) %> <fieldset> <div class="cssform"> <p> <%= Html.LabelFor(model => model.Email)%><em>*</em> <%= Html.TextBoxFor(model => model.Email, new { @class = "required email" })%> <%= Html.ValidationMessageFor(model => model.Email)%> </p> <p> <%= Html.Label("Confirm email")%><em>*</em> <%= Html.TextBox("confirm_email")%> <%= Html.ValidationMessage("confirm_email") %> </p> <p> <%= Html.Label("Password")%><em>*</em> <%= Html.Password("Password", null, new { @class = "required" })%> <%= Html.ValidationMessage("Password")%><br /> (Note: Password should be minimum 6 characters) </p> <p> <%= Html.Label("Confirm Password")%><em>*</em> <%= Html.Password("confirm_password")%> <%= Html.ValidationMessage("confirm_password") %> </p><hr /> <p>Note: Confirmation email will be sent to the email address listed above.</p> </fieldset> <% } %>

    Read the article

  • MySQL access classes in PHP

    - by Mike
    I have a connection class for MySQL that looks like this: class MySQLConnect { private $connection; private static $instances = 0; function __construct() { if(MySQLConnect::$instances == 0) { //Connect to MySQL server $this->connection = mysql_connect(MySQLConfig::HOST, MySQLConfig::USER, MySQLConfig::PASS) or die("Error: Unable to connect to the MySQL Server."); MySQLConnect::$instances = 1; } else { $msg = "Close the existing instance of the MySQLConnector class."; die($msg); } } public function singleQuery($query, $databasename) { mysql_select_db(MySQLConfig::DB, $this->connection) or die("Error: Could not select database " . MySQLConfig::DB . " from the server."); $result = mysql_query($query) or die('Query failed.'); return $result; } public function createResultSet($query, $databasename) { $rs = new MySQLResultSet($query, MySQLConfig::DB, $this->connection ) ; return $rs; } public function close() { MySQLConnect::$instances = 0; if(isset($this->connection) ) { mysql_close($this->connection) ; unset($this->connection) ; } } public function __destruct() { $this->close(); } } The MySQLResultSet class looks like this: class MySQLResultSet implements Iterator { private $query; private $databasename; private $connection; private $result; private $currentRow; private $key = 0; private $valid; public function __construct($query, $databasename, $connection) { $this->query = $query; //Select the database $selectedDatabase = mysql_select_db($databasename, $connection) or die("Error: Could not select database " . $this->dbname . " from the server."); $this->result = mysql_query($this->query) or die('Query failed.'); $this->rewind(); } public function getResult() { return $this->result; } // public function getRow() // { // return mysql_fetch_row($this->result); // } public function getNumberRows() { return mysql_num_rows($this->result); } //current() returns the current row public function current() { return $this->currentRow; } //key() returns the current index public function key() { return $this->key; } //next() moves forward one index public function next() { if($this->currentRow = mysql_fetch_array($this->result) ) { $this->valid = true; $this->key++; }else{ $this->valid = false; } } //rewind() moves to the starting index public function rewind() { $this->key = 0; if(mysql_num_rows($this->result) > 0) { if(mysql_data_seek($this->result, 0) ) { $this->valid = true; $this->key = 0; $this->currentRow = mysql_fetch_array($this->result); } } else { $this->valid = false; } } //valid returns 1 if the current position is a valid array index //and 0 if it is not valid public function valid() { return $this->valid; } } The following class is an example of how I am accessing the database: class ImageCount { public function getCount() { $mysqlConnector = new MySQLConnect(); $query = "SELECT * FROM images;"; $resultSet = $mysqlConnector->createResultSet($query, MySQLConfig::DB); $mysqlConnector->close(); return $resultSet->getNumberRows(); } } I use the ImageCount class like this: if(!ImageCount::getCount()) { //Do something } Question: Is this an okay way to access the database? Could anybody recommend an alternative method if it is bad? Thank-you.

    Read the article

  • Whats a valid strategy for a secure image upload from a flash client?

    - by WillyCornbread
    Hi all - I'm creating a flash application that will post images to a url for saving to disk/display later. I was wondering what are some suggested strategies for making this secure enough so that the upload is verified as coming from the application and not just some random form post. Is it reliable enough to check referring location realizing that I don't need bulletproof security, or perhaps setting authentication headers is a better strategy even though it seems unreliable from what I have read. Thanks for any advice - b

    Read the article

  • Can I improve this regex check for valid domain names?

    - by Josh
    So, I have been working on this domain name regular expression. So far, it seems to pick up domain names with SLDs and TLDs (with the optional ccTLD), but there is duplication of the TLD listing. Can this be refactored any further? params[:domain_name].downcase.strip.match(/^[a-z0-9\-]{2,63} \.((a[cdefgilmnoqrstuwxz]|aero|arpa)|(b[abdefghijmnorstvwyz]|biz)| (c[acdfghiklmnorsuvxyz]|cat|com|coop)|d[ejkmoz]|(e[ceghrstu]|edu)|f[ijkmor]| (g[abdefghilmnpqrstuwy]|gov)|h[kmnrtu]|(i[delmnoqrst]|info|int)| (j[emop]|jobs)|k[eghimnprwyz]|l[abcikrstuvy]| (m[acdghklmnopqrstuvwxyz]|me|mil|mobi|museum)|(n[acefgilopruz]|name|net)|(om|org)| (p[aefghklmnrstwy]|pro)|qa|r[eouw]|s[abcdeghijklmnortvyz]| (t[cdfghjklmnoprtvwz]|travel)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]) (\.((a[cdefgilmnoqrstuwxz]|aero|arpa)|(b[abdefghijmnorstvwyz]|biz)| (c[acdfghiklmnorsuvxyz]|cat|com|coop)|d[ejkmoz]|(e[ceghrstu]|edu)|f[ijkmor]| (g[abdefghilmnpqrstuwy]|gov)|h[kmnrtu]|(i[delmnoqrst]|info|int)| (j[emop]|jobs)|k[eghimnprwyz]|l[abcikrstuvy]| m[acdghklmnopqrstuvwxyz]|mil|mobi|museum)| (n[acefgilopruz]|name|net)|(om|org)| (p[aefghklmnrstwy]|pro)|qa|r[eouw]|s[abcdeghijklmnortvyz]| (t[cdfghjklmnoprtvwz]|travel)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]))?$/)

    Read the article

  • Is this a valid pattern for raising events in C#?

    - by Will Vousden
    Update: For the benefit of anyone reading this, since .NET 4, the lock is unnecessary due to changes in synchronization of auto-generated events, so I just use this now: public static void Raise<T>(this EventHandler<T> handler, object sender, T e) where T : EventArgs { if (handler != null) { handlerCopy(sender, e); } } And to raise it: SomeEvent.Raise(this, new FooEventArgs()); Having been reading one of Jon Skeet's articles on multithreading, I've tried to encapsulate the approach he advocates to raising an event in an extension method like so (with a similar generic version): public static void Raise(this EventHandler handler, object @lock, object sender, EventArgs e) { EventHandler handlerCopy; lock (@lock) { handlerCopy = handler; } if (handlerCopy != null) { handlerCopy(sender, e); } } This can then be called like so: protected virtual void OnSomeEvent(EventArgs e) { this.someEvent.Raise(this.eventLock, this, e); } Are there any problems with doing this? Also, I'm a little confused about the necessity of the lock in the first place. As I understand it, the delegate is copied in the example in the article to avoid the possibility of it changing (and becoming null) between the null check and the delegate call. However, I was under the impression that access/assignment of this kind is atomic, so why is the lock necessary? Update: With regards to Mark Simpson's comment below, I threw together a test: static class Program { private static Action foo; private static Action bar; private static Action test; static void Main(string[] args) { foo = () => Console.WriteLine("Foo"); bar = () => Console.WriteLine("Bar"); test += foo; test += bar; test.Test(); Console.ReadKey(true); } public static void Test(this Action action) { action(); test -= foo; Console.WriteLine(); action(); } } This outputs: Foo Bar Foo Bar This illustrates that the delegate parameter to the method (action) does not mirror the argument that was passed into it (test), which is kind of expected, I guess. My question is will this affect the validity of the lock in the context of my Raise extension method? Update: Here is the code I'm now using. It's not quite as elegant as I'd have liked, but it seems to work: public static void Raise<T>(this object sender, ref EventHandler<T> handler, object eventLock, T e) where T : EventArgs { EventHandler<T> copy; lock (eventLock) { copy = handler; } if (copy != null) { copy(sender, e); } }

    Read the article

  • Why is one Func valid and the other (almost identical) not.

    - by runrunraygun
    private static Dictionary<Type, Func<string, object>> _parseActions = new Dictionary<Type, Func<string, object>> { { typeof(bool), value => {Convert.ToBoolean(value) ;}} }; The above gives an error Error 14 Not all code paths return a value in lambda expression of type 'System.Func<string,object>' However this below is ok. private static Dictionary<Type, Func<string, object>> _parseActions = new Dictionary<Type, Func<string, object>> { { typeof(bool), value => Convert.ToBoolean(value) } }; I don't understand the difference between the two. I thought the extra braces in example1 are to allow us to use multiple lines in the anon function so why have they affected the meaning of the code?

    Read the article

  • Is it valid for Hibernate list() to return duplicates?

    - by skaffman
    Is anyone aware of the validity of Hibernate's Criteria.list() and Query.list() methods returning multiple occurrences of the same entity? Occasionally I find when using the Criteria API, that changing the default fetch strategy in my class mapping definition (from "select" to "join") can sometimes affect how many references to the same entity can appear in the resulting output of list(), and I'm unsure whether to treat this as a bug or not. The javadoc does not define it, it simply says "The list of matched query results." (thanks guys). If this is expected and normal behaviour, then I can de-dup the list myself, that's not a problem, but if it's a bug, then I would prefer to avoid it, rather than de-dup the results and try to ignore it. Anyone got any experience of this?

    Read the article

  • Is there any valid reason radians are used as the inputs to trig function in many modern languages?

    - by johnmortal
    Is there any pressing reason trig functions should use radian inputs in modern programming languages? As far as I know radians are typically ugly to deal with except in three cases: (1) You want to compute an arc length and you know the angle of the arc and (2) You need to do symbolic calculus with trig functions (3) certain infinite series expansion look prettier if the input is in radians. None of these scenarios seem like a worthy justification for every programming language I am familiar with using radian inputs for Sin, Cos, Tangent, etc... The third one sounds good because it might mean one gets faster computations using radians (very slightly faster- the cost of one additional floating point multiplication ) , but I am dubious even of that because most commonly the developer had to take an extra step to put the angle in radians in the first place. The other two are ridiculous justifications for all the added obscurity.

    Read the article

  • Is it valid syntax to have ordered and unordered lists in sequence in markdown?

    - by nfm
    I just wrote some markdown and it doesn't seem to render correctly. Is it legal syntax to have an ordered list, followed by newlines, then followed by an unordered list? Or is this a bug in bluecloth? For example: 1. One 2. Two 3. Three * Apple * Banana * Carrot Bluecloth creates a single <ul> and nests apple, banana and carrot as <li>'s under it. Stackoverflow's markdown parser does this too. Am I just doing it wrong? Surely this is a common usage case...

    Read the article

  • What would cause objectForKey: to return null with a valid string in place?

    - by theMikeSwan
    I am having an issue with NSDictionary returning null for an NSString even though the string in in the dictionary. Here is the code: - (void)sourceDidChange:(NSNotification *)aNote { NSDictionary *aDict = [aNote userInfo]; DLog(@"%@", aDict); NSString *newSourceString = [aDict objectForKey:@"newSource"]; DLog(@"%@", newSourceString); newSourceString = [newSourceString stringByReplacingOccurrencesOfString:@" " withString:@""]; DLog(@"%@", newSourceString); NSString *inspectorString = [newSourceString stringByAppendingString:@"InspectorController"]; DLog(@"%@", inspectorString); newSourceString = [newSourceString stringByAppendingString:@"ViewController"]; DLog(@"%@", newSourceString); } And I get the following log statements: 2010-04-17 23:50:13.913 CoreDataUISandbox[13417:a0f] -[RightViewController sourceDidChange:] newSource = "Second View"; 2010-04-17 23:50:13.914 CoreDataUISandbox[13417:a0f] -[RightViewController sourceDidChange:] (null) 2010-04-17 23:50:13.916 CoreDataUISandbox[13417:a0f] -[RightViewController sourceDidChange:] (null) 2010-04-17 23:50:13.917 CoreDataUISandbox[13417:a0f] -[RightViewController sourceDidChange:] (null) 2010-04-17 23:50:13.917 CoreDataUISandbox[13417:a0f] -[RightViewController sourceDidChange:] (null) As you can see the string is in the dictionary under the key newSource, yet when I call objectForKey: I get null. I have even tried the fallback option of cleaning the project. Has anyone ever run into this, or have I just forgotten something really basic?

    Read the article

  • How to install vmware tools?

    - by Tom
    I installed my Ubuntu in vmware, no I need install vmware tools, I got error: Searching for a valid kernel header path... The path "" is not valid. Would you like to change it?[yes] In CentOS, I run the following command to resolve this issue: yum install gcc-c++ yum install kernel-devel yum install kernel-headers yum -y update kernel But I don't know how to do in Ubuntu. Please help. Update I have tried the following command but nothing changed,still got error: Searching for a valid kernel header path... The path "" is not valid. Would you like to change it?[yes] sudo apt-get update sudo-get install build-essential linux-header-$(uname -r) sudo ./vmware-uninstall-tools.pl sudo ./vmware-config-tools.pl sudo ./vmware-install.pl Issue Changed: Run sudo ./vmware-uninstall-tools.pl, and delete the folder of /etc/vmware-tools then, run sudo ./vmware-install.pl Now I can successfully install vmware-tool.After restart, I can see folder of /mnt/hgfs, but can't see my shared folder.

    Read the article

  • PHP rewrite to included file - is this a valid script?

    - by Poni
    Hi all! I've made this question: http://stackoverflow.com/questions/2921469/php-mutual-exclusion-mutex As said there, I want several sources to send their stats once in a while, and these stats will be showed at the website's main page. My problem is that I want this to be done in an atomic manner, so no update of the stats will overlap another one running in the background. Now, I came up with this solution and I want you PHP experts to judge it. stats.php <?php define("my_counter", 12); ?> index.php <?php include "stats.php"; echo constant("my_counter"); ?> update.php <?php $old_error_reporting = error_reporting(0); include "stats.php"; define("my_stats_template",' <?php define("my_counter", %d); ?> '); $fd = fopen("stats.php", "w+"); if($fd) { if (flock($fd, LOCK_EX)) { $my_counter = 0; try { $my_counter = constant("my_counter"); } catch(Exception $e) { } $my_counter++; $new_stats = sprintf(constant("my_stats_template"), $my_counter); echo "Counter should stand at $my_counter"; fwrite($fd, $new_stats); } flock($fd, LOCK_UN); fclose($fd); } error_reporting($old_error_reporting); ?> Several clients will call the "update.php" file once every 60sec each. The "index.php" is going to use the "stats.php" file all the time as you can see. What's your opinion?

    Read the article

  • Valid HTTP header? `GET /page.html Http1.0`?

    - by Earlz
    Ok so I've been reading up on HTTP and found this page. This is an example HTTP request that was posted there: GET /http.html Http1.1 Host: www.http.header.free.fr Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, Accept-Language: Fr Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0) Connection: Keep-Alive I tried it in telnet and it worked. But everywhere else I see this kind of request line GET /http.html HTTP/1.1 The important different is that HTTP is all caps and the / character. Are they both correct? They both seem to work on the sites I've tested it on. I've skimmed the RFC of HTTP but didn't find anything of use. Has anyone else seen this kind of request header? Is it officially supported?

    Read the article

  • Is this a valid benefit of using embedded SQL over stored procedures?

    - by George
    Here's an argument for SPs that I haven't heard. Flamers, be gentle with the down tick, Since there is overhead associated with each trip to the database server, I would suggest that a POSSIBLE reason for placing your SQL in SPs over embedded code is that you are more insulated to change without taking a performance hit. For example. Let's say you need to perform Query A that returns a scalar integer. Then, later, the requirements change and you decide that it the results of the scalar is x that then, and only then, you need to perform another query. If you performed the first query in a SP, you could easily check the result of the first query and conditionally execute the 2nd SQL in the same SP. How would you do this efficiently in embedded SQL w/o perform a separate query or an unnecessary query? Here's an example: --This SP may return 1 or two queries. SELECT @CustCount = COUNT(*) FROM CUSTOMER IF @CustCount 10 SELECT * FROM PRODUCT Can this/what is the best way to do this in embedded SQL?

    Read the article

  • Is there a way to get all valid keywords for CSS property?

    - by NV
    Round two. First was "How do I get all supported CSS properties in WebKit?". I'm looking for magic CSSkeywords function: CSSkeywords('float') --> ['left', 'right', 'none'] CSSkeywords('width') --> ['auto'] CSSkeywords('background') --> [ ["repeat", "repeat-x", "repeat-y", "no-repeat"], ["scroll", "fixed"], ["top", "center", "bottom", "left"], /*regexp for color*/, /*regexp for url*/, "none" ]

    Read the article

  • Generating different randoms valid for a day on different independent devices?

    - by Pentium10
    Let me describe the system. There are several mobile devices, each independent from each other, and they are generating content for the same record id. I want to avoid generating the same content for the same record on different devices, for this I though I would use a random and make it so too cluster the content pool based on these randoms. Suppose you have choices from 1 to 100. Day 1 Device#1 will choose for the record#33 between 1-10 Device#2 will choose for the record#33 between 40-50 Device#3 will choose for the record#33 between 50-60 Device#1 will choose for the record#55 between 40-50 Device#2 will choose for the record#55 between 1-10 Device#3 will choose for the record#55 between 10-20 Device#1 will choose for the record#11 between 1-10 Device#2 will choose for the record#22 between 1-10 Device#3 will choose for the record#99 between 1-10 Day 2 Device#1 will choose for the record#33 between 90-100 Device#2 will choose for the record#33 between 1-10 Device#3 will choose for the record#33 between 50-60 They don't have access to a central server. Data available for each of them: IMEI (unique per mobile) Date of today (same on all devices) Record id (same on all devices) What do you think, how is it possible? ps. tags can be edited

    Read the article

  • Are ternary operators not valid for linq-to-sql queries?

    - by KallDrexx
    I am trying to display a nullable date time in my JSON response. In my MVC Controller I am running the following query: var requests = (from r in _context.TestRequests where r.scheduled_time == null && r.TestRequestRuns.Count > 0 select new { id = r.id, name = r.name, start = DateAndTimeDisplayString(r.TestRequestRuns.First().start_dt), end = r.TestRequestRuns.First().end_dt.HasValue ? DateAndTimeDisplayString(r.TestRequestRuns.First().end_dt.Value) : string.Empty }); When I run requests.ToArray() I get the following exception: Could not translate expression ' Table(TestRequest) .Where(r => ((r.scheduled_time == null) AndAlso (r.TestRequestRuns.Count > 0))) .Select(r => new <>f__AnonymousType18`4(id = r.id, name = r.name, start = value(QAWebTools.Controllers.TestRequestsController). DateAndTimeDisplayString(r.TestRequestRuns.First().start_dt), end = IIF(r.TestRequestRuns.First().end_dt.HasValue, value(QAWebTools.Controllers.TestRequestsController). DateAndTimeDisplayString(r.TestRequestRuns.First().end_dt.Value), Invoke(value(System.Func`1[System.String])))))' into SQL and could not treat it as a local expression. If I comment out the end = line, everything seems to run correctly, so it doesn't seem to be the use of my local DateAndTimeDisplayString method, so the only thing I can think of is Linq to Sql doesn't like Ternary operators? I think I've used ternary operators before, but I can't remember if I did it in this code base or another code base (that uses EF4 instead of L2S). Is this true, or am I missing some other issue?

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >