Search Results

Search found 1872 results on 75 pages for 'tom lilletveit'.

Page 51/75 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • Cannot pass null to server using jQuery AJAX. Value received at the server is the string "null".

    - by Tom
    I am converting a javascript/php/ajax application to use jQuery to ensure compatibility with browsers other than Firefox. I am having trouble passing true, false, and null values using jQuery's ajax function. Javascript code: $.ajax ( { url : <server_url>, dataType: 'json', type : 'POST', success : receiveAjaxMessage, data: { valueTrue : true, valueFalse : false, valueNull : null } } ); PHP code: var_dump($_POST); Server output: array(3) { ["valueTrue"]=> string(4) "true" ["valueFalse"]=> string(5) "false" ["valueNull"]=> string(4) "null" } The problem is that the null, true, and false values are being converted to strings. The Javascript AJAX code currently in use passes null, true, and false correctly but only works in Firefox. Does anyone know how to solve this problem using jQuery? Here is some working code (not using jQuery) to compare with the code not-working code given above. Javascript Code: ajaxPort.send ( <server_url>, { valueTrue : true, valueFalse : false, valueNull : null } ); PHP code: var_dump(json_decode(file_get_contents('php://input'), true)); Server output: array(3) { ["valueTrue"]=> bool(true) ["valueFalse"]=> bool(false) ["valueNull"]=> NULL } Note that the null, true, and false values are correctly received. Note also that in the second method the $_POST array is not used in the PHP code. I think this is the key to the problem, but I cannot find a way to replicate this behavior using jQuery.

    Read the article

  • ServiceStack razor default page

    - by Tom
    Say I have 2 pages /NotADefault.cshtml /Views/Default.cshtml Question 1. Now I run it, page A always gets called implicitly as start-up default page no matter what I name it. Page B will only be called when I explicitly call localhost/View/Default. How do I make page B (the one in View folder) my default page? Question 2. I also have NotADefaultService.cs and DefaultService.cs. I give each page a Service class at the back. However, when page A is called NotADefaultService.cs never gets called. Only DefaultService.cs gets called when page B is called... My observation is that only the pages in the View folder will get their back-end service class working. Outside of View folder it doesn't work. Combining Q1 and Q2. How do I: Option 1. get the backend service class working under / root outside "View" folder? OR Option 2. appoint /View/Default.schtml as my default at start-up where the service class can be hit?

    Read the article

  • Linq Scope Problem + Reduce Repeated Code

    - by Tom Gullen
    If the parameter is -1, it needs to run a different query as to if an ID was specified... how do I do this? I've tried initialising var q; outside the If block but no luck! // Loads by Entry ID, or if -1, by latest entry private void LoadEntryByID(int EntryID) { IEnumerable<tblBlogEntry> q; if (EntryID == -1) { q = ( from Blog in db.tblBlogEntries orderby Blog.date descending select new { Blog.ID, Blog.title, Blog.entry, Blog.date, Blog.userID, Comments = ( from BlogComments in db.tblBlogComments where BlogComments.blogID == Blog.ID select BlogComments).Count(), Username = ( from Users in db.yaf_Users where Users.UserID == Blog.userID select new { Users.DisplayName }) }).FirstOrDefault(); } else { q = ( from Blog in db.tblBlogEntries where Blog.ID == EntryID select new { Blog.ID, Blog.title, Blog.entry, Blog.date, Blog.userID, Comments = ( from BlogComments in db.tblBlogComments where BlogComments.blogID == Blog.ID select BlogComments).Count(), Username = ( from Users in db.yaf_Users where Users.UserID == Blog.userID select new { Users.DisplayName }) }).SingleOrDefault(); } if (q == null) { this.Loaded = false; } else { this.ID = q.ID; this.Title = q.title; this.Entry = q.entry; this.Date = (DateTime)q.date; this.UserID = (int)q.userID; this.Loaded = true; this.AuthorUsername = q.Username; } } My main aim is to reduce repeating code

    Read the article

  • MySQL: Is it possible to return a "mixed" dataset?

    - by Tom
    Hi, I'm wondering if there's some clever way in MySQL to return a "mixed/balanced" dataset according to a specific criterion? To illustrate, let's say that there are potential results in a table that can be of Type 1 or Type 2 (i.e. a column has a value 1 or 2 for each record). Is there a clever query that would be able to directly return results alternating between 1 and 2 in sequence: 1st record is of type 1, 2nd record is of type 2, 3rd record is of type 1, 4th record is of type 2, etc... Apologies if the question is silly, just looking for some options. Of course, I could return any data and do this in PHP, but it does add some code. Thanks.

    Read the article

  • Is there any way to maximize PHP_INT_MAX?

    - by Tom
    I can't find this row in php.ini, so is there any way to do that? So ok, I understood, the answer is not, then how should I calculate the result of this task if I want it do with php? The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ?

    Read the article

  • looking to scan documents directly to be uploaded to a webpage

    - by Tom
    I was hoping to do this from a flash plugin, kind of how flash accesses the microphone or webcam but it doesn't seem possible. Is this going to be possible using Java, or ActiveX, or some other strategy that I haven't looked at yet? The idea is to do it without a client install, or at least something lightweight and browser and platform independent, (and possibly the moon on a stick as welll ;-))

    Read the article

  • Enums With Default Throw Clause?

    - by Tom Tresansky
    I noticed the following in the Java Language spec in the section on enumerations here: link switch(this) { case PLUS: return x + y; case MINUS: return x - y; case TIMES: return x * y; case DIVIDE: return x / y; } throw new AssertionError("Unknown op: " + this); However, looking at the switch statement definition section, I didn't notice this particular syntax (the associated throw statement) anywhere. Can I use this sort of "default case is throw an exception" syntactic sugar outside of enum definitions? Does it have any special name? Is this considered a good/bad practice for short-cutting this behavior of "anything not in the list throws an exception"?

    Read the article

  • [C++] Multiple inheritance from template class

    - by Tom P.
    Hello, I'm having issues with multiple inheritance from different instantiations of the same template class. Specifically, I'm trying to do this: template <class T> class Base { public: Base() : obj(NULL) { } virtual ~Base() { if( obj != NULL ) delete obj; } template <class T> T* createBase() { obj = new T(); return obj; } protected: T* obj; }; class Something { // ... }; class SomethingElse { // ... }; class Derived : public Base<Something>, public Base<SomethingElse> { }; int main() { Derived* d = new Derived(); Something* smth1 = d->createBase<Something>(); SomethingElse* smth2 = d->createBase<SomethingElse>(); delete d; return 0; } When I try to compile the above code, I get the following errors: 1>[...](41) : error C2440: '=' : cannot convert from 'SomethingElse *' to 'Something *' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1> [...](71) : see reference to function template instantiation 'T *Base<Something>::createBase<SomethingElse>(void)' being compiled 1> with 1> [ 1> T=SomethingElse 1> ] 1>[...](43) : error C2440: 'return' : cannot convert from 'Something *' to 'SomethingElse *' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast The issue seems to be ambiguity due to member obj being inherited from both Base< Something and Base< SomethingElse , and I can work around it by disambiguating my calls to createBase: Something* smth1 = d->Base<Something>::createBase<Something>(); SomethingElse* smth2 = d->Base<SomethingElse>::createBase<SomethingElse>(); However, this solution is dreadfully impractical, syntactically speaking, and I'd prefer something more elegant. Moreover, I'm puzzled by the first error message. It seems to imply that there is an instantiation createBase< SomethingElse in Base< Something , but how is that even possible? Any information or advice regarding this issue would be much appreciated.

    Read the article

  • iFrame Access Problem

    - by Tom
    Hi Guys, I have data which sits outside an iframe with a script on the outside as well. When a user performs an action - I want this ata to be sent "inside" the iframe. I have having a bit trouble achieving this and was wondering whether its possible and if it is, how I can do it ? Thx

    Read the article

  • Lua + SWIG Monkey Patching

    - by Tom J Nowell
    I have used SWIG to bind a set of classes to lua. The problem comes if I want to start monkey patching. e.g. game.GetEnemies1 = game.GetEnemies2 does not work as expected. The behaviour after that line is still consistent with the original GetEnemies1 not GetEnemies2. how do I combat this problem?

    Read the article

  • Why NullPointerException is a runtime exception and RemoteException not?

    - by Tom Brito
    A possible reason because a NullPointerException is a runtime exception is because every method can throw it, so every method would need to have a "throws NullPointerException", and would be ugly. But this happens with RemoteException. And a possible reason because RemoteException is not a runtime exception, is to tell it client to treat the exception. But every method in a remote environment need throws it, so there is no difference of throwing NullPointerException. Speculations? Was I clear?

    Read the article

  • Parsing a Vimeo ID using Javascript?

    - by Tom
    Hi, Could anyone point me in the right direction to parse an ID from a Vimeo URL in Javascript? The URL will be entered by a user so I will need to check that they have entered it in the correct format. I need the ID so that I can use their simple API to retrieve video data. Any help appreciated.

    Read the article

  • CFEXCHANGECONNECTION error when username changes.

    - by Tom Hubbard
    We are attempting to connect to an Exchange server through CFEXCHANGECONNECTION on ColdFusion 9 to retrieve email. We can connect with a number of users. However, some users cannot connect. We end up with the following error: Cannot access Exchange server as a web application at <server> It turns out that the users who cannot connect either have a ampersand in there username or they have changed there username with CFLDAP. So, if I perform a CFLDAP on a working user and change the userPrincipalName and sAMAccountName the user will begin getting the error above. If I change it back to what it was to start with, the error will go away. Any ideas? EDIT The ampersand part seems to be misleading. Essentially we found the problem because of the ampersand. However, for working users who did not have an ampersand, the error will begins showing up if their username is changed to something that does not have an ampersand.

    Read the article

  • Javascript: sort objects

    - by tom
    function Player() { var score; this.getScore = function() { return score; } this.setScore = function(sc) { score = sc; } } function compare(playerA, playerB) { return playerA.getScore() - playerB.getScore(); } var players = []; players['player1'] = new Player(); players['player2'] = new Player(); Array(players).sort(compare); I have code that is similar to the above. When I step through the code with a debugger, the compare function never gets called and the array isn't sorted. I'm not sure what's wrong with my code?

    Read the article

  • SQL Server 2005 Weird varchar Behavior

    - by Tom Tresansky
    This SQL Server 2005 T-SQL code: DECLARE @Test1 varchar; SET @Test1 = 'dog'; DECLARE @Test2 varchar(10); SET @Test2 = 'cat'; SELECT @Test1 AS Result1, @Test2 AS Result2; produces: Result1 = d Result2 = cat I would expect either The assignment SET @Test1 = 'dog'; to fail because there isn't enough room in @Test1 Or the SELECT to return 'dog' in the Result1 column. What is up with @Test1? Could someone please explain this behavior?

    Read the article

  • C++ vector<T>::iterator operator +

    - by Tom
    Hi, Im holding an iterator that points to an element of a vector, and I would like to compare it to the next element of the vector. Here is what I have Class Point{ public: float x,y; } //Somewhere in my code I do this vector<Point> points = line.getPoints(); foo (points.begin(),points.end()); where foo is: void foo (Vector<Point>::iterator begin,Vector<Point>::iterator end) { std::Vector<Point>::iterator current = begin; for(;current!=end-1;++current) { std::Vector<Point>::iterator next = current + 1; //Compare between current and next. } } I thought that this would work, but current + 1 is not giving me the next element of the vector. I though operator+ was the way to go, but doesnt seem so. Is there a workaround on this? THanks

    Read the article

  • JSONP & jQuery Chunking

    - by Tom
    Hi Guys, I am wanting to utilize JSONP for a project with x-domain scripting but little concerned with the 2048 character limit in IE. Does JSONP support "chunking" automatically if character size exceeds 2048 ? If yes, does anyone have any examples they can share ? Thx

    Read the article

  • AES Key encoded byte[] to String and back to byte[]

    - by Tom Brito
    In the similar question "Conversion of byte[] into a String and then back to a byte[]" is said to not to do the byte[] to String and back conversion, what looks like apply to most cases, mainly when you don't know the encoding used. But, in my case I'm trying to save to a DB the javax.crypto.SecretKey data, and recoverd it after. The interface provide a method getEncoded() which returns the key data encoded as byte[], and with another class I can use this byte[] to recover the key. So, the question is, how do I write the key bytes as String, and later get back the byte[] to regenerate the key?

    Read the article

  • TextBox loses text when InvokeRequired == false

    - by Tom
    This is modified code I found on this site. When appending text to a TextBox and InvoveRequired is false the text will display in the box but the next time the function is called and InvokeRequired is true the text string placed by the first call is lost (""). Multiple calls when InvokeRequired is true work as expected. comBox is a type TextBox with multline = true. Any help would be appreciated. public void LogComText(string comText, bool newline) { if (comBox.InvokeRequired) { comBox.BeginInvoke(new Action(delegate { LogComText(comText, newline); })); return; } comBox.AppendText(comText); if (newline) comBox.AppendText(Environment.NewLine); }

    Read the article

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