Search Results

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

Page 42/1913 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • -1 as a return value

    - by dimadima
    This question is specifically about PHP, but I'm guessing it might be applicable to other languages as well. I've noticed that between PHP4 and PHP5, the designers of the language shifted away from using -1 as a return value to using constants or other forms of output. This makes sense, as -1 is not particularly evocative, and I'm guessing this practice led to confusion. That said, I am sometimes inclined to return -1 when I want to quickly add another return option to a function, and -1 often seems like a perfectly valid way to express the outcome I am coding for. So here are my questions: Is my observation generally correct, regarding the move away from -1 as a return value in PHP5 vs PHP4? What are the cons of returning -1, beyond for the reason I mentioned above, wherein the -1 return value doesn't contribute positively to code clarity?

    Read the article

  • Retruning reference to object not changing the address in c++

    - by ashish-sangwan
    I am trying to understand function returning reference. For that i have written a simple program :- include using namespace std; class test { int i; friend test& func(); public: test(int j){i=j;} void show(){cout< }; test& func() { test temp(10); return temp; //// Address of temp=0xbfcb2874 } int main() { test obj1(50); // Address of obj1=0xbfcb28a0 func()=obj1; <= Problem:The address of obj1 is not changing obj1.show(); // // Address of obj1=0xbfcb28a0 return 0; } I run the program using gdb and observed that the address of obj1 still remains same but i expect it to get changed to 0xbfcb2874. I am not clear with the concept. Please help. Thanks in advance

    Read the article

  • Returning reference to object is not changing the address in c++

    - by ashish-sangwan
    I am trying to understand functions returning a reference. For that I have written a simple program: #include<iostream> using namespace std; class test { int i; friend test& func(); public: test(int j){i=j;} void show(){cout<<i<<endl;} }; test& func() { test temp(10); return temp; //// Address of temp=0xbfcb2874 } int main() { test obj1(50); // Address of obj1=0xbfcb28a0 func()=obj1; <= Problem:The address of obj1 is not changing obj1.show(); // // Address of obj1=0xbfcb28a0 return 0; } I ran the program using gdb and observed that the address of obj1 still remains same, but I expect it to get changed to 0xbfcb2874. I am not clear with the concept. Please help.

    Read the article

  • Hold a network connection although IP address change

    - by rursw1
    Hi, Is it possible to hold an open TCP connection with a client, while the IP address of the client is externally changed? For example, the connection is establishes against address X, but somewhen while the connection is open, the client-side user asks for IP renew and gets another IP address. Can the connection remains alive in this case? Thanks in advance.

    Read the article

  • Ensuring the contacts in a Distribution List are displayed with both name and email address

    - by hawbsl
    How can I ensure the contacts I add to an Outlook distribution list are displayed with both name and email address? These contacts may not exist in any other address book, just the distribution list. Currently they show up just as an email address (in both columns). Here's roughly the VBA we're using: Do Until RS.EOF //here's where we want to inject RS!FirstName, RS!Surname etc objRecipients.Add RS!Email objRecipients.Resolve RS.MoveNext Loop Set objDistList = contactsFolder.Items.Add("IPM.DistList") objDistList.DLName = "Whatever" objDistList.AddMembers objRecipients objDistList.Save etc

    Read the article

  • How do you make sure your pakcet is delivered to right client using public ip address

    - by TemporaryNickName
    So private IP addresses are 192.168.00 ~ 192.168.255.255 or 10.0.0.0 or 172.16.0.0 ~ 172.31.255.255 If I accepted a client to my serversocket, I can get the client's remoteIp address by using socket.getremotesocketaddress(); But I suspect the IP address that I'm getting from this method is only the public IP address and it must have more than one client using same public IP as this one (one like you see when you go on to the website www.whatismyip.com). So if I want to make sure that my packet is delivered to the right person using some IP address or otherthing that uniquely identifies a person, what should I have to do?

    Read the article

  • Oracle sql developer can acess from loalhost but not ip address

    - by Welcome Always
    Here i have installed widows server 2008 64 orale 11g r2 64 now i want to access this from the ip address that i have set to my server not working i can't access trough the ip address.... when i use on my application .....local host it can get connected but when i add the ip for example 10.0.0.2 it's not connecting now simply also on local when i write the ip address it's not connecting but with localhost works fine..... so even i have used listener. regards

    Read the article

  • How to return relationships in a custom un-typed dataservice provider

    - by monkey_p
    I have a custom .Net DataService and can't figure out how to return the data for relationships. The data base has 2 tables (Customer, Address). A Customer can have multiple addresses, but each address can only have on customer. I'm using Dictionary<string,object> as my data type. My question, for the following 2 urls how do i return the data. http://localhost/DataService/Customer(1)/Address http://localhost/DataService/Address(1)/Customer For the none relational queries I return a List<Dictionary<string,object>> So I imagined for the relation I should just populate the element with a either a Dictionary<string,object> for the single ones and a List<Dictionary<string,object>> for many relationships. But this just gives me a NullRefferenceException So what am I doing wrong?

    Read the article

  • how to get memory address

    - by levirg
    hey Folks, Is there any way in ruby to get the memory address of objects.. say.. (i = 5) is that possible to get the mem address of that object 5.. 'object_id_' is not that satisfying.. I just wanted to know how referencing to objects work on ruby, so i thought address will be useful, to get things done plugin memprof doesnt work on x_32bit, so is there any better way pls help me..., Any answer would be really appreciated... thanks, Regards levirg

    Read the article

  • hiding file in address bar

    - by michael
    hi, i've created a php pagination system, but i want to hide the _GET variable in the address bar. atm mine looks like this http://address.com/images.php?page=1 but i've seen a few site that have http://address.com/images/1/. just wondering how they go about this? can anyone point me in the right direction, cheers

    Read the article

  • Organize address cache

    - by Orsol
    Hi, I need to organize cache in mySql database for address - coordinates. What is the best practice to store address? Do i need to compress address string or use it as is? edit: Ok, let's I reassert my question. How to store long (up to 512) string in database if I need to search by exactly this string in future.

    Read the article

  • jQuery Ajax returns the whole page

    - by Sophia Gavish
    Dear all, I have a jquery-ajax function that sends data to a php script and the problem is with the return value, it returns the whole page instead of single value. Thank you for your time and help. $("#ajaxBtn").click(function(){ var inputText = $("#testText").val(); $.ajax({ type: "POST", url: "index.php", data: "testAjax="+inputText, dataType: "html", success: function(html){ alert(html); } }); });

    Read the article

  • What is the difference between array parameters in C

    - by STeN
    Hi, what is the difference between following function declarations, which create and return the array in C/C++? Both methods create the array and fill it with proper values and returns true if everything passed. bool getArray(int* array); bool getArray(int* array[]); Thanks Best Regards, STeN

    Read the article

  • How to implement an interface member that returns void in F#

    - by Drew Noakes
    Imagine the following interface in C#: interface IFoo { void Bar(); } How can I implement this in F#? All the examples I've found during 30 minutes of searching online show only examples that have return types which I suppose is more common in a functional style, but something I can't avoid in this instance. Here's what I have so far: type Bar() = interface IFoo with member this.Bar = void Fails with FS0010: Unexpected keyword 'void' in expression.

    Read the article

  • creating and returning an array from a method

    - by Troy
    howdy, i currently have a method that checks what is around the centre item in a 3x3 grid, if what is in the 8 adjacent positions is containing what i am checking for i want to mark that square on an array with length 7 as being 1. to do this i need to create and return an array in my method, is it possible to do this?

    Read the article

  • Does Ruby have a special stack for returning a value?

    - by prosseek
    The following Ruby code def a(b,c) b+c end is the same as follows with Python def a(b,c): return b+c It looks like that ruby has the special stack that stores the final evaluation result and returns the value when a function is called. If so, what's the name of the stack, and how can I get that stack? If not, how does the Ruby code work without returning something?

    Read the article

  • Will my shared variables loose value? (asp.net vb)

    - by Phil
    I have a class includes.vb that holds some variables (sharing them with other pages) like: Public Shared pageid As Integer = 0 I then have a function that does some work with these variables returning them with values; Return pageid When I step through the code, the variables have values (while stepping through the function), but when they are returned to the page, they come back null. Do they loose value everytime a page is loaded? Can you suggest an alternative method? Thanks a lot.

    Read the article

  • How to either return JSON or RedirectToAction?

    - by DaveDev
    I have an Action Method that I'd either like to return JSON from on one condition or redirect on another condition. I thought that I could do this by returning ActionResult from my method but doing this causes the error "not all code paths return a value" Can anyone tell me what I'm doing wrong? Or how to achieve the desired result? Here's the code below: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Login(User user) { var myErrors = new Dictionary<string, string>(); try { if (ModelState.IsValid) { if (userRepository.ValidUser(user)) { RedirectToAction("Index", "Group"); //return Json("Valid"); } else { return Json("Invalid"); } } else { foreach (KeyValuePair<string, ModelState> keyValuePair in ViewData.ModelState) { if (keyValuePair.Value.Errors.Count > 0) { List<string> errors = new List<string>(); myErrors.Add(keyValuePair.Key, keyValuePair.Value.Errors[0].ErrorMessage); } } return Json(myErrors); } } catch (Exception) { return Json("Invalid"); } }

    Read the article

  • Invalid method declaration, return type required

    - by Brett Steen
    I am getting an error at public Rectangle(double width, double height){ saying that it's an invalid method declaration, return type required. I'm not sure how to fix it. These are also my instructions for my assignment: Write a super class encapsulating a rectangle. A rectangle has two attributes representing the width and the height of the rectangle. It has methods returning the perimeter and the area of the rectangle. This class has a subclass, encapsulating a parallelepiped, or box. A parallelepiped has a rectangle as its base, and another attribute, its length. It has two methods that calculate and return its area and volume. `public class Rectangle1 { private double width; private double height; public Rectangle1(){ } public Rectangle(double width, double height){ this.width = width; this.height = height; } public double getWidth(){ return width; } public void setWidth(double width) { this.width = width; } public double getHeight(){ return height; } public void setHeight(double height){ this.height = height; } public double getArea(){ return width * height; } public double getPerimeter(){ return 2 * (width + height); } } public class TestRectangle { public static void main(String[] args) { Rectangle1 rectangle = new Rectangle1(2,4); System.out.println("\nA rectangle " + rectangle.toString()); System.out.println("The area is " + rectangle.getArea()); System.out.println("The perimeter is " + rectangle.getPerimeter()); } }`

    Read the article

  • How do I DYNAMICALLY cast in C# and return for a property

    - by ken-forslund
    I've already read threads on the topic, but can't find a solution that fits. I'm working on a drop-down list that takes an enum and uses that to populate itself. i found a VB.NET one. During the porting process, I discovered that it uses DirectCast() to set the type as it returns the SelectedValue. See the original VB here: http://jeffhandley.com/archive/2008/01/27/enum-list-dropdown-control.aspx the gist is, the control has Type _enumType; //gets set when the datasource is set and is the type of the specific enum The SelectedValue property kind of looks like (remember, it doesn't work): public Enum SelectedValue //Shadows Property { get { // Get the value from the request to allow for disabled viewstate string RequestValue = this.Page.Request.Params[this.UniqueID]; return Enum.Parse(_enumType, RequestValue, true) as _enumType; } set { base.SelectedValue = value.ToString(); } } Now this touches on a core point that I think was missed in the other discussions. In darn near every example, folks argued that DirectCast wasn't needed, because in every example, they statically defined the type. That's not the case here. As the programmer of the control, I don't know the type. Therefore, I can't cast it. Additionally, the following examples of lines won't compile because c# casting doesn't accept a variable. Whereas VB's CType and DirectCast can accept Type T as a function parameter: return Enum.Parse(_enumType, RequestValue, true); or return Enum.Parse(_enumType, RequestValue, true) as _enumType; or return (_enumType)Enum.Parse(_enumType, RequestValue, true) ; or return Convert.ChangeType(Enum.Parse(_enumType, RequestValue, true), _enumType); or return CastTo<_enumType>(Enum.Parse(_enumType, RequestValue, true)); So, any ideas on a solution? What's the .NET 3.5 best way to resolve this?

    Read the article

  • Get email address from OpenID provider (Janrain openid library)

    - by Moak
    When signing in to stackoverflow with google I get this message Stackoverflow.com is asking for some information from your Google Account [email protected] • Email address: [email protected] However on my site I can log in with openid but I can't ask for the email address. I get this message You are signing in to example.com with your Google Account [email protected] Also I'm finding it hard to know at what step I need to ask for it, here's some code where I think that step should be built into. /** * Authenticates the given OpenId identity. * Defined by Zend_Auth_Adapter_Interface. * * @throws Zend_Auth_Adapter_Exception If answering the authentication query is impossible * @return Zend_Auth_Result */ public function authenticate() { $id = $this->_id; $consumer = new Auth_OpenID_Consumer($this->_storage); if (!empty($id)) { $authRequest = $consumer->begin($id); if (is_null($authRequest)) { return new Zend_Auth_Result( Zend_Auth_Result::FAILURE, $id, array("Authentication failed", 'Unknown error')); } if (Auth_OpenID::isFailure($authRequest)) { return new Zend_Auth_Result( Zend_Auth_Result::FAILURE, $id, array("Authentication failed", "Could not redirect to server: " . $authRequest->message)); } $redirectUrl = $authRequest->redirectUrl($this->_root, $this->_returnTo); if (Auth_OpenID::isFailure($redirectUrl)) { return new Zend_Auth_Result( Zend_Auth_Result::FAILURE, $id, array("Authentication failed", $redirectUrl->message)); } Zend_OpenId::redirect($redirectUrl); } else { $response = $consumer->complete(Zend_OpenId::selfUrl()); switch($response->status) { case Auth_OpenID_CANCEL: case Auth_OpenID_FAILURE: return new Zend_Auth_Result( Zend_Auth_Result::FAILURE, null, array("Authentication failed. " . @$response->message)); break; case Auth_OpenID_SUCCESS: return $this->_constructSuccessfulResult($response); break; } } } It seems like such an obvious thing but I'm having a hard time googling and combing through the code just to find this. Thanks!

    Read the article

  • How to return a value from facebook javascript connect api fucntions

    - by dezwald
    I am trying to create wrapper functions on facebook javascript connect api methods. My problem is that i can not return a value within the facebook api FB_RequireFeatures method. i want my isFBConnected() function to return true or false based on if i'm logged into facebook or not. What is happening is that when i return true it returns it to the child function, which makes sense however, my global "login" variable does not get set to true. I've tried setting a timeout to wait until the facebook connect finishes executing and still no luck. any help or other solutions are welcome! my isFBConnected wrapper function is stated below: function isFBConnected(){ var api_key = '<?=$this->apiKey?>'; var channel_path = '<?=$this->xdReceiver?>'; var host_url = '<?=$this->hostUrl?>'; var servicePathShort = '<?=$this->servicePathShort?>'; var login = false; FB_RequireFeatures(["Api"], function(){ // Create an ApiClient object, passing app's API key and // a site relative URL to xd_receiver.htm FB.Facebook.init(api_key, channel_path); var api = FB.Facebook.apiClient; // If FB user session exists - load stats data if(api.get_session()!=null){ if(api.get_session().uid!='' && api.get_session().uid!=undefined){ login = true; alert(api.get_session().uid); return true; } } login = false; return false; }); return false; }

    Read the article

  • Trouble deciding return type of a method that returns a SortedSet

    - by devoured elysium
    I am supposed to make a class that should be a container for an interval of values (like in mathematics). I have already decided that I'll use internally a SortedSet. One of the the things I'm supposed to implement is a method that "gets an ordered set with all the elements in the interval". class Interval { private SortedSet sortedSet = new something(); ... <<method that should return an ordered set of values>> } My question resides in what should be both the method's return type and name. Several hypothesis arise: SortedSet getSortedElements(); I am internally using a SortedSet, so I should return that type. I should state that intent in the method's name. SortedSet getElements(); I am internally using a SortedSet, but there's no point in stating that in the method name(I don't see a big point in this one). Set getElements(); I should try to always return the most basic type, thus I am returning a Set. By the contract and definition of the method, people already know all the elements are in order. Set getSortedElements(); For the method return type, the same as above. About the method name, you are stating clearly what this method is going to return: a set of elements that are sorted. I'm inclined to use 4. , but the others also seem alright. Is there a clear winner? Why?

    Read the article

  • dnsmasq acts as the DHCP server for selected nodes overriding the existing DHCP server on the same LAN?

    - by user183394
    I am trying to set up a small "lab" at home. Like many modern homes, I have a regular DSL service which comes with a 2Wire 3600HGV router, which acts also as a DHCP server. Since I would like to PXE boot a few computers in my "lab" The 2Wire is inflexible to adjustments that I want to do I have used dnsmasq at work so I would like to use dnsmasq as the DHCP server for the few nodes in my "lab" if feasible. In the dnsmasq man page, there is the following: [...] -K, --dhcp-authoritative (IPv4 only) Should be set when dnsmasq is definitely the only DHCP server on a network. It changes the behaviour from strict RFC compliance so that DHCP requests on unknown leases from unknown hosts are not ignored. This allows new hosts to get a lease without a tedious timeout under all circumstances. It also allows dnsmasq to rebuild its lease database without each client needing to reacquire a lease, if the database is lost. [...] As far as I know, the ISC DHCP server can use the following to do what I would like to accomplish: authoritative; [...] subnet 192.168.1.0 netmask 255.255.255.0 { host nb0 { # only give DHCP information to this computer: hardware ethernet e8:9a:8f:17:70:42; fixed-address 192.168.1.10; option subnet-mask 255.255.255.0; option routers 192.168.1.254; option domain-name-servers 192.168.1.254; # Non-essential DHCP options filename "/pxelinux.0"; } [...] But I much prefer dnsmasq's "all-in-one-ness". My question: do I have to couple the -K option with something else? As shown in the example above, the ISC DHCP server requires the mac addresses of managed nodes to be explicitly specified. Does dnsmasq have something similar? FYI, the machine on which I plan to run dnsmasq runs CentOS 6.3 64bit. It has a statically assigned IP address: 192.168.1.3.

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >