Search Results

Search found 47805 results on 1913 pages for 'return address'.

Page 58/1913 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • Cannot return view model after POST

    - by Interfector
    HI, I am trying to return a model after a POST but I receive the following error: Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object. Line 29: public UsersModel getUser(Int32 id) { Line 30: return ( Line 31: from users in db.NUsers Line 32: join userSettings in db.NUsersSettings The code in the controller looks like this: [AcceptVerbs( HttpVerbs.Post )] public ActionResult Edit( NUsers user ) { //Other code that doesn't affect the error :) UsersModel userDetails = this.usersObj.getUser( user.UserID ); return View( userDetails ); } The getUser method looks like this: public UsersModel getUser(Int32 id) { return ( from users in db.NUsers join userSettings in db.NUsersSettings on users.UserID equals userSettings.UserID where users.UserID == id select new UsersModel { UserId = Convert.ToInt32( users.UserID ), Email = Convert.ToString( users.Email ), FirstName = Convert.ToString( users.FirstName ), LastName = Convert.ToString( users.LastName ), Language = Convert.ToString( userSettings.Language ), Phone = Convert.ToString( users.Phone ) } ).First(); } and finally the UsersModel if you think it is relevant: public class UsersModel { public int UserId; public string Email; public string FirstName; public string LastName; public string Language; public string Phone; public List<NLanguages> Languages; public UsersModel() { Models.Languages languagesObj = new Models.Languages(); Languages = languagesObj.getLanguages(); } } Any thoughts on what might be causing the error and what can I do to fix it? Thx

    Read the article

  • How to return value using ajax

    - by Priyanka
    Hello. I have Ajax file in which code has written to accept values form user and then these values are taken in a Ajax function as follows: $(document).ready(function(){ $("#newsletterform").validate(); $('#Submit').click(function(){ var name = $('#newsletter_name').val(); var email = $('#newsletter_email').val(); sendValue(email,name); }); }); The function for paasing values and getting values from other file: function sendValue(str,name){ $.post( "newsletter/subscribe.php", //Ajax file { sendValue: str, sendVal: name }, function(data2){ $('#display').html(data2.returnValue); }, //How you want the data formated when it is returned from the server. "json" ); } and these values are passed to another file called "subscribe.php" in which insertion code to database is written and again I return the value to my first ajax function as follows: echo json_encode(array("returnValue"=$msg)); The msg is ging to contain my message to be displayed. But now, this works fine on localhost, I get the return values nad message properly but when I upload it on server this gives me an error as: data2 is null [Break on this error] $('#display').html(data2.returnValue); This only gives error for return value but insertion, sending mail functionality works fine. Please provide me with a good solution wherein I can be able to get back the return values without any error. Thanks in advance.

    Read the article

  • Return type from DAL class (Sql ce, Linq to Sql)

    - by bretddog
    Hi, Using VS2008 and Sql CE 3.5, and preferably Linq to Sql. I'm learning database, and unsure about DAL methods return types and how/where to map the data over to my business objects: I don't want direct UI binding. A business object class UserData, and a class UserDataList (Inherits List(Of UserData)), is represented in the database by the table "Users". I use SQL Compact and run SqlMetal which creates dbml/designer.vb file. This gives me a class with a TableAttribute: <Table()> _ Partial Public Class Users I'm unsure how to use this class. Should my business object know about this class, such that the DAL can return the type Users, or List(Of Users) ? So for example the "UserDataService Class" is a part of the DAL, and would have for example the functions GetAll and GetById. Will this be correct : ? Public Class UserDataService Public Function GetAll() As List(Of Users) Dim ctx As New MyDB(connection) Dim q As List(Of Users) = From n In ctx.Users Select n Return q End Function Public Function GetById(ByVal id As Integer) As Users Dim ctx As New MyDB(connection) Dim q As Users = (From n In ctx.Users Where n.UserID = id Select n).Single Return q End Function And then, would I perhaps have a method, say in the UserDataList class, like: Public Class UserDataList Inherits List(Of UserData) Public Sub LoadFromDatabase() Me.clear() Dim database as New UserDataService dim users as List(Of Users) users = database.GetAll() For each u in users dim newUser as new UserData newUser.Id = u.Id newUser.Name = u.Name Me.Add(newUser) Next End Sub End Class Is this a sensible approach? Would appreciate any suggestions/alternatives, as this is my first attempt on a database DAL. cheers!

    Read the article

  • Should I return an NSMutableString in a method that returns NSString

    - by Casey Marshall
    Ok, so I have a method that takes an NSString as input, does an operation on the contents of this string, and returns the processed string. So the declaration is: - (NSString *) processString: (NSString *) str; The question: should I just return the NSMutableString instance that I used as my "work" buffer, or should I create a new NSString around the mutable one, and return that? So should I do this: - (NSString *) processString: (NSString *) str { NSMutableString *work = [NSMutableString stringWithString: str]; // process 'work' return work; } Or this: - (NSString *) processString: (NSString *) str { NSMutableString *work = [NSMutableString stringWithString: str]; // process 'work' return [NSString stringWithString: work]; // or [work stringValue]? } The second one makes another copy of the string I'm returning, unless NSString does smart things like copy-on-modify. But the first one is returning something the caller could, in theory, go and modify later. I don't care if they do that, since the string is theirs. But are there valid reasons for preferring the latter form over the former? And, is either stringWithString or stringValue preferred over the other?

    Read the article

  • Call Python From PHP And Get Return Code

    - by seaboy
    Hello everyone, I am calling a python script from PHP. The python program has to return some value according to the arguments passed to it. Here is a sample python program, which will give you a basic idea of what i am doing currently: #!/usr/bin/python import sys #get the arguments passed argList = sys.argv #Not enough arguments. Exit with a value of 1. if len(argList) < 3: #Return with a value of 1. sys.exit(1) arg1 = argList[1] arg2 = argList[2] #Check arguments. Exit with the appropriate value. if len(arg1) > 255: #Exit with a value of 4. sys.exit(4) if len(arg2) < 2: #Exit with a value of 8. sys.exit(8) #Do further coding using the arguments------ #If program works successfully, exit with a value of 0 As you can see from the above code, my basic aim is for the python program to return some values (0,1,4,8 etc) depending on the arguments. And then the calling PHP program to access these returned values and do the appropriate operation. Currently i have used "sys.exit(n)", for that purpose. Am i right in using sys.exit, or do I need to use something else? And also what method exists in PHP so that I can access the return code from python? Sorry for the long question, but hopefully it will help in you understanding my dilemma Thanks a ton

    Read the article

  • return only the last select results from stored procedure

    - by Madalina Dragomir
    The requirement says: stored procedure meant to search data, based on 5 identifiers. If there is an exact match return ONLY the exact match, if not but there is an exact match on the not null parameters return ONLY these results, otherwise return any match on any 4 not null parameters... and so on My (simplified) code looks like: create procedure xxxSearch @a nvarchar(80), @b nvarchar(80)... as begin select whatever from MyTable t where ((@a is null and t.a is null) or (@a = t.a)) and ((@b is null and t.b is null) or (@b = t.b))... if @@ROWCOUNT = 0 begin select whatever from MyTable t where ((@a is null) or (@a = t.a)) and ((@b is null) or (@b = t.b))... if @@ROWCOUNT = 0 begin ... end end end As a result there can be more sets of results selected, the first ones empty and I only need the last one. I know that it is easy to get the only the last result set on the application side, but all our stored procedure calls go through a framework that expects the significant results in the first table and I'm not eager to change it and test all the existing SPs. Is there a way to return only the last select results from a stored procedure? Is there a better way to do this task ?

    Read the article

  • C Programing - Return libcurl http response to string to the calling function

    - by empty set
    I have a homework and i need somehow to compare two http responses. I am writing it on C (dumb decision) and i use libcurl to make things easier. I am calling the function that uses libcurl to http request and response from another function and i want to return the http response to it. Anyway, the code below doesn't work, any ideas? #include <stdio.h> #include <curl/curl.h> #include <string.h> size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) { size_t written; written = fwrite(ptr, size, nmemb, stream); return written; } char *handle_url(void) { CURL *curl; char *fp; CURLcode res; char *url = "http://www.yahoo.com"; curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); res = curl_easy_perform(curl); if(res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); curl_easy_cleanup(curl); //printf("\n%s", fp); } return fp; } This solution C libcurl get output into a string works, but not in my case because i want to return this string to the calling function.

    Read the article

  • caching previous return values of procedures in scheme

    - by Brock
    In Chapter 16 of "The Seasoned Schemer", the authors define a recursive procedure "depth", which returns 'pizza nested in n lists, e.g (depth 3) is (((pizza))). They then improve it as "depthM", which caches its return values using set! in the lists Ns and Rs, which together form a lookup-table, so you don't have to recurse all the way down if you reach a return value you've seen before. E.g. If I've already computed (depthM 8), when I later compute (depthM 9), I just lookup the return value of (depthM 8) and cons it onto null, instead of recursing all the way down to (depthM 0). But then they move the Ns and Rs inside the procedure, and initialize them to null with "let". Why doesn't this completely defeat the point of caching the return values? From a bit of experimentation, it appears that the Ns and Rs are being reinitialized on every call to "depthM". Am I misunderstanding their point? I guess my question is really this: Is there a way in Scheme to have lexically-scoped variables preserve their values in between calls to a procedure, like you can do in Perl 5.10 with "state" variables?

    Read the article

  • asp.net mvc 2 - return JavaScript with View

    - by Tomaszewski
    Hi, using ASP.NET MVC 2 I have a navigation menu inside my Master Page. In the navigation menu, I am trying add a class to the that the current page relates to (i.e., home page will add class="active" to the Home button). I'm trying to consider scalability and the fact that I don't want to change individual pages if the navigation changes later. The only way I can think of doing this is: Add JavaScript to each individual View that will add the class when the DOM is ready Return JavaScript when return View() occurs on point (2), I am unsure how to do. Thusfar I have been doing the following in my controller: public ActionResult Index() { ViewData["messege"] = JavaScript("<script type='text/javascript' language='javascript'> $(document).ready(function () { console.log('hi hi hi'); }); </script>"); return View(); } but in my view, when I call: <%: ViewData["messege"] %> I get: System.Web.Mvc.JavaScriptResult as the result Would you guys have any ideas on How to solve the navigation menu probelem, other than the solutions I've listed return JavaScript along with your view from the Controller Thanks, in advanced!

    Read the article

  • 1 error with an array "missing return statement"

    - by danielit0w
    import javax.swing.JOptionPane; public class Mate { double suma (double x1,double x2) {return x1+x2;} double suma (double x1,double x2,double x3) {return x1+x2+x3;} double suma (int num [ ]) {int i=num.length; int j=0; int s=0; for(j=0;j < i;j++) {return (double)(s);}}} // here appears the error "missing return statement" class AplicacionMate {public static void main (String arg []) {int n[ ]={5,4,3,2,1}; double r=0.0; Mate m=new Mate ( ); r=m.suma(5,4); JOptionPane.showMessageDialog(null,"La suma 1="+r); r=m.suma(5,5,4); JOptionPane.showMessageDialog(null,"La suma 2="+r); r=m.suma(n); JOptionPane.showMessageDialog(null,"La suma del arreglo="+r); System.exit(0);}}

    Read the article

  • Using Generics to return a literal string or from Dictionary<string, object>

    - by Mike
    I think I outsmarted myself this time. Feel free to edit the title also I could not think of a good one. I am reading from a file and then in that file will be a string because its like an xml file. But in the file will be a literal value or a "command" to get the value from the workContainer so <Email>[email protected]</Email> or <Email>[? MyEmail ?]</Email> What I wanted to do instead of writing ifs all over the place to put it in a generic function so logic is If Container command grab from container else grab string and convert to desired type Its up to the user to ensure the file is ok and the type is correct so another example is so <Answer>3</Answer> or <Answer>[? NumberOfSales ?]</Answer> This is the procedure I started to work on public class WorkContainer:Dictionary<string, object> { public T GetKeyValue<T>(string Parameter) { if (Parameter.StartsWith("[? ")) { string key = Parameter.Replace("[? ", "").Replace(" ?]", ""); if (this.ContainsKey(key)) { return (T)this[key]; } else { // may throw error for value types return default(T); } } else { // Does not Compile if (typeof(T) is string) { return Parameter } // OR return (T)Parameter } } } The Call would be mail.To = container.GetKeyValue<string>("[email protected]"); or mail.To = container.GetKeyValue<string>("[? MyEmail ?]"); int answer = container.GetKeyValue<int>("3"); or answer = container.GetKeyValue<int>("[? NumberOfSales ?]"); But it does not compile?

    Read the article

  • I want a function to return a type of the subclass its invoked from

    - by Jay
    I want to have a function defined in a superclass that returns a value of the type of the subclass that is used to invoke the function. That is, say I have class A with a function plugh. Then I create subclasses B and C that extend A. I want B.plugh to return a B and C.plugh to return a C. Yes, they could return an A, but then the caller would have to either cast it to the right subtype, which is a pain when used a lot, or declare the receiving variable to be of the supertype, which loses type safety. So I was trying to do this with generics, writing something like this: class A<T extends A> { private T foo; public T getFoo() { return foo; } } class B extends A<B> { public void calcFoo() { foo=... whatever ... } } class C extends A<C> { public void calcFoo() { foo=... whatever ... } } This appears to work but it looks pretty ugly. For one thing, I get warnings on "class A". The compiler says that A is generic and I should specify the type. I guess it wants me to say "class A". But what would I put in for x? I think I could get stuck in an infinite loop here. It seems weird to write "class B extends A", but this causes no complaints, so maybe that's just fine. Is this the right way to do it? Is there a better way?

    Read the article

  • WCF - Return object without serializing?

    - by Mayo
    One of my WCF functions returns an object that has a member variable of a type from another library that is beyond my control. I cannot decorate that library's classes. In fact, I cannot even use DataContractSurrogate because the library's classes have private member variables that are essential to operation (i.e. if I return the object without those private member variables, the public properties throw exceptions). If I say that interoperability for this particular method is not needed (at least until the owners of this library can revise to make their objects serializable), is it possible for me to use WCF to return this object such that it can at least be consumed by a .NET client? How do I go about doing that? Update: I am adding pseudo code below... // My code, I have control [DataContract] public class MyObject { private TheirObject theirObject; [DataMember] public int SomeNumber { get { return theirObject.SomeNumber; } // public property exposed private set { } } } // Their code, I have no control public class TheirObject { private TheirOtherObject theirOtherObject; public int SomeNumber { get { return theirOtherObject.SomeOtherProperty; } set { // ... } } } I've tried adding DataMember to my instance of their object, making it public, using a DataContractSurrogate, and even manually streaming the object. In all cases, I get some error that eventually leads back to their object not being explicitly serializable.

    Read the article

  • Minimal framework in Scala for collections with inheriting return type

    - by Rex Kerr
    Suppose one wants to build a novel generic class, Novel[A]. This class will contain lots of useful methods--perhaps it is a type of collection--and therefore you want to subclass it. But you want the methods to return the type of the subclass, not the original type. In Scala 2.8, what is the minimal amount of work one has to do so that methods of that class will return the relevant subclass, not the original? For example, class Novel[A] /* What goes here? */ { /* Must you have stuff here? */ def reverse/* What goes here instead of :Novel[A]? */ = //... def revrev/*?*/ = reverse.reverse } class ShortStory[A] extends Novel[A] /* What goes here? */ { override def reverse: /*?*/ = //... } val ss = new ShortStory[String] val ss2 = ss.revrev // Type had better be ShortStory[String], not Novel[String] Does this minimal amount change if you want Novel to be covariant? (The 2.8 collections do this among other things, but they also play with return types in more fancy (and useful) ways--the question is how little framework one can get away with if one only wants this subtypes-always-return-subtypes feature.)

    Read the article

  • C# Possible to have a generic return type?

    - by JL
    Here is a typical function that returns either true/false; private static bool hasValue() { return true; } Now on an error, I would like to return my own custom error object with definition: public class Failure { public string failureDateTime { get; set; } public string failureReason { get; set; } } I would have expected to be able to throw this custom object for example... private static bool hasValue() { throw new Failure(); } This is not possible, and I don't want to derive Failure from System.IO.Exception because of the inability to serialize an exception in C#. What is the best practice / or ideal solution to this problem. Should I just work with private static object? Or is there a cleaner way to return a custom object or bypass the typical return type on an error (not using System.IO.Exception)? Not entirely wild about object either, because then I need to cast the result and validate it by more boolean logic.

    Read the article

  • Redmine does not return the web page

    - by m0skit0
    I migrated a Redmine installation from an Ubuntu machine to a Debian one (both 32-bits), and now for some reason, for some users it doesn't return the page but only a 200 OK message. Here is the flow (from Wireshark): GET /issues/142 HTTP/1.1 Host: debian:3000 User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:17.0) Gecko/20100101 Firefox/17.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive Cookie: _redmine_session=BAh7DCIQX2NzcmZfdG9rZW4iMStIM1RBNTlNelZVUXlUazgrR1pUNGUvNGdEbytUZzRyMVFSUnBvNGhlSDg9Ihd0aW1lbG9nX2luZGV4X3NvcnQiEnNwZW50X29uOmRlc2MiD3Nlc3Npb25faWQiJThiMDk0MzVhOTEzYTI0MzVjOGEzYTRmNDU0NzcwMTAwIgx1c2VyX2lkaQoiFmlzc3Vlc19pbmRleF9zb3J0IgxpZDpkZXNjIg1wZXJfcGFnZWlpIgpxdWVyeXsHOg9wcm9qZWN0X2lkaQc6B2lkaQo%3D--8588c221c0642a12f396239455fb702aec14c9c9; my_wiki_session=f70ae11e1c533c86f0e039d63cf3f69c; my_wikiUserID=1; my_wikiUserName=Yasin Cache-Control: max-age=0 HTTP/1.1 200 OK Connection: Keep-Alive Date: Wed, 12 Dec 2012 16:30:16 GMT Server: WEBrick/1.3.1 (Ruby/1.8.7/2010-08-16) Content-Length: 0 As you can see, I get nothing from the server. This is mostly random because this blank page happens sometimes for some users, and for other users it almost never returns the page... I'm absolutely lost here. Any idea about what can be the cause? Thanks in advance!

    Read the article

  • IP address reuse on macvlan devices

    - by Alex Bubnoff
    I'm trying to create easy to use and possibly simple testing environment for some product and got some strange behaviour of macvlan's. What I'm trying to achieve: make a toolset for one-line start/stop of lxc containers(via docker) bound to external ip(I have enough of it on host machine). So, I'm doing something like this: docker run -d -name=container_name container_image pipework eth1 container_name ip/prefix_len@gateway and pipework here does this: GUEST_IFNAME=ph$NSPID$eth1 ip link add link eth1 dev $GUEST_IFNAME type macvlan mode bridge ip link set eth1 up ip link set $GUEST_IFNAME netns $NSPID ip netns exec $NSPID ip link set $GUEST_IFNAME name eth1 ip netns exec $NSPID ip addr add $IPADDR dev eth1 ip netns exec $NSPID ip route delete default ip netns exec $NSPID ip link set eth1 up ip netns exec $NSPID ip route replace default via $GATEWAY ip netns exec $NSPID arping -c 1 -A -I eth1 $IPADDR And it works for first time per IP. But for second time and later packets for containers IP isn't getting into container, while all configuration seem fine. So it looks like this: External machine ? ping 212.76.131.212 ....silence.... Host machine root@ubuntu:~# ip link show eth1 2: eth1: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:15:17:c9:e1:c9 brd ff:ff:ff:ff:ff:ff root@ubuntu:~# ip addr show eth1 2: eth1: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:15:17:c9:e1:c9 brd ff:ff:ff:ff:ff:ff root@ubuntu:~# tcpdump -v -i eth1 icmp tcpdump: WARNING: eth1: no IPv4 address assigned tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes 00:00:46.542042 IP (tos 0x0, ttl 60, id 9623, offset 0, flags [DF], proto ICMP (1), length 84) 5.134.221.98 212.76.131.212: ICMP echo request, id 6718, seq 2345, length 64 00:00:47.549969 IP (tos 0x0, ttl 60, id 9624, offset 0, flags [DF], proto ICMP (1), length 84) 5.134.221.98 212.76.131.212: ICMP echo request, id 6718, seq 2346, length 64 00:00:48.558143 IP (tos 0x0, ttl 60, id 9625, offset 0, flags [DF], proto ICMP (1), length 84) 5.134.221.98 212.76.131.212: ICMP echo request, id 6718, seq 2347, length 64 00:00:49.566319 IP (tos 0x0, ttl 60, id 9626, offset 0, flags [DF], proto ICMP (1), length 84) 5.134.221.98 212.76.131.212: ICMP echo request, id 6718, seq 2348, length 64 00:00:50.573999 IP (tos 0x0, ttl 60, id 9627, offset 0, flags [DF], proto ICMP (1), length 84) 5.134.221.98 212.76.131.212: ICMP echo request, id 6718, seq 2349, length 64 ^C 5 packets captured 5 packets received by filter 0 packets dropped by kernel 1 packet dropped by interface Host machine, netns of container root@ubuntu:~# ip netns exec 32053 ip link show eth1 48: eth1@if2: mtu 1500 qdisc noqueue state UNKNOWN link/ether b2:12:f7:cc:a1:9d brd ff:ff:ff:ff:ff:ff root@ubuntu:~# ip netns exec 32053 ip addr show eth1 48: eth1@if2: mtu 1500 qdisc noqueue state UNKNOWN link/ether b2:12:f7:cc:a1:9d brd ff:ff:ff:ff:ff:ff inet 212.76.131.212/29 scope global eth1 inet6 fe80::b012:f7ff:fecc:a19d/64 scope link valid_lft forever preferred_lft forever root@ubuntu:~# ip netns exec 32053 tcpdump -v -i eth1 icmp tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes ....silence.... ^C 0 packets captured 0 packets received by filter 0 packets dropped by kernel So, can anyone say, what can it be? Can this be caused by not a bug in macvlan implementation? Is there any tools I can use to debug that configuration?

    Read the article

  • Is it possible to access javascript return value outside of function? [on hold]

    - by Kinnard Hockenhull
    How would one access javascript function's return value outside of the function? For example could you tell a function to return something somewhere else in the code? Theoretical example: milkmachine = function(argument){ var r; var k; //do something with arguments and variables return r; } var rainbow = milkmachine(); //rainbow == r milkmachine.return(k); var spectrum = milkmachine(); //spectrum == k

    Read the article

  • Return HTTP 404 when MVC2 view does not exist

    - by Dmitriy Nagirnyak
    Hi, I just need to have the a small CMS-like controller. The easiest way would be something like this: public class HomeController : Controller { public ActionResult View(string name) { if (!ViewExists(name)) return new HttpNotFoundResult(); return View(name); } private bool ViewExists(string name) { // How to check if the view exists without checking the file itself? } } The question is how to return HTTP 404 if the there is no view available? Probably I can check the files in appropriate locations and cache the result, but that feels really dirty. Thanks, Dmitriy.

    Read the article

  • how to return C++ pointer in objective-C++

    - by John Smith
    I have the following objective-C++ header with the simple method to return this pointer. @interface MyObj { MyCPPObj * cpp; } -(MyCPPObj *) getObj; I have created the simple method @implementation MyObj -(MyCPPObj *) getObj { return cpp; } Everything seems to work until I actually try to use the object in another file newObj = [createdMyObj getObj]; It complains: error: cannot convert 'objc_object*' to 'MyCPPObje *' in initialization. It seems that the method is return an objective-c object, but I specifically requested a C++ pointer. How can I fix that?

    Read the article

  • PHP - can a method return a pointer?

    - by Kerry
    I have a method in a class trying to return a pointer: <?php public function prepare( $query ) { // bla bla bla return &$this->statement; } ?> But it produces the following error: Parse error: syntax error, unexpected '&' in /home/realst34/public_html/s98_fw/classes/sql.php on line 246 This code, however, works: <?php public function prepare( $query ) { // bla bla bla $statement = &$this->statement; return $statement; } ?> Is this just the nature of PHP or am I doing something wrong?

    Read the article

  • How do I return an Array from grails / jdo to Flex

    - by mswallace
    this seems really simple but I haven't gotten this to work. I am building my app with grails on google app engine. This pretty much requires you to use JDO. I am making an HTTP call from flex to my app. The action that I am calling on the grails end looks like so def returnShowsByDate = { def query = persistenceManager.newQuery( Show ) def showInstanceList = query.execute() return (List<Show>) showInstanceList } I have tried just returning "hello from grails" and that works just fine. I have alos tried the following return showInstanceList the JDO docs say the query.execute() returns a collection. Why I cant just return that to Flex I have no clue. Any thoughts?

    Read the article

  • Implementing Autocompletion in iPhone UITextField for contacts in address book

    - by nacho4d
    Hi, I would like to have a UITextField or UITextView in where as I do some input, alternatives will appear something similar to when you type an address in Mail Application, alternatives appear down and is possible tap them so get a better input user interface.(since there is no need to type the complete word or address or phone number) I do know how to fetch data from Address Book framework, also how to input text in UITextField/UITextView and its delegates but I don't know what kind of structure to use for fetching and showing data as the user do his/her input. I know basic CoreData if this matters, I hope I can get some help. UPDATE (2010/3/10): I don't have problem make a native-like GUI but I am asking about the algorithm, does any body knows what kind algorithm is best for this thing? maybe some binary tree? Or should I just fetch data from coredata everytime? Thanks Ignacio UPDATE (2010/03/28): I've been very busy these days, so I have not tried UISearchResults but it seems fine to me. BUT I wonder was there a necessity of deletion of the wining answer? I don't think is fair my reputation went down and couldn't see the winning answer. ;(

    Read the article

  • Encoding a email address that can be used as part of a URL in codeigniter

    - by freedayum
    Is there a way to encode a email address that can be used as a part of a url in codeigniter?. I need to decode back the email address from the url. What I am trying to do is just a -forgotten password recovery- thing. I send a confirmation link to the user's email address, the link needs to be like ../encodedEmail/forgottenPasswordCode (with the forgottenPasswordCode updated in the db for the user with the submitted email). When the user visits that link, I decode the email(if the email - forgottenPasswordCode pair is in the table), i allow them to reset their password (and i reset forgottenPasswordCode back to null). I could just do a loop -checking the table with a select query- (or) -set that forgottenPasswordCode column unique, so i keep generating on a insert failure(would that be a lot faster ?)- until I generate a forgottenPasswordCode that doesn't already exist in the table. But the guy I do this for would not accept it this way:). He wants the checking be done with the user's email, he thinks its much faster. I am working with codeigniter, I used its encode() function, it seems to produce characters like '-slashes-' at times that breaks the encoded-email-string. Any other ideas?

    Read the article

  • How to return model state from child action handler in ASP.NET MVC

    - by Joe Future
    In my blog engine, I have one controller action that displays blog content, and in that view, I call Html.RenderAction(...) to render the "CreateComment" form. When a user posts a comment, the post is handled by the comment controller (not the blog controller). If the comment data is valid, I simply return a Redirect back to the blog page's URL. If the comment data is invalid (e.g. comment body is empty), I want to return the ViewData with the error information back to the blog controller and through the blog view to the CreateComment action/view so I can display which fields are bad. I have this working fine via AJAX when Javascript is enabled, but now I'm working on the case where Javascript might be disabled. If I return a RedirecToAction or Redirect from the comment controller, the model state information is lost. Any ideas?

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >