Search Results

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

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

  • conflicting types for a function return in C

    - by Adi
    Hi all, Here is my question : I am doing a recursive program and I am getting an error saying conflicting types: Code is : void* buddyMalloc(int req_size) { //Do something here// return buddy_findout(original_index,req_size); //This is the recursive fn I call// } void *buddy_findout(int current_index,int req_size) { char *selected = NULL; if(front!=NULL) { if(current_index==original_index) { //Do something here// return selected ; // } else { //Do Something here// return buddy_findout(current_index+1,req_size); } } else { return buddy_findout(current_index-1,req_size); } } In the above code , "I am getting error like : conflicting types of buddy_findout " Thanks for the help in advance aditya

    Read the article

  • Returning new base class when the parent class shared pointer is the return type

    - by Ben Dol
    Can you have a parent class shared pointer return type of a function and then return a new child class without it being a shared pointer? I'm not sure how shared pointers work in these situations, do they act like a regular pointer? Here is my example: BaseEventPtr Actions::getEvent(const std::string& nodeName) { if(asLowerCaseString(nodeName) == "action") return new ActionEvent(&m_interface); return nullptr; } ActionEvent is the subclass of BaseEvent in this situation. Cheers!

    Read the article

  • What to return when making an Ajax request

    - by Russell
    When we return data from an Ajax call, is it better to return a document containing HTML to display on the page or return an Xml/json data which can be processed? I know different circumstances may determine what 'better' means, but I really want to know which will be more appropriate for different circumstances. I am working on the framework for a large ASP .Net application, using jQuery Ajax (forms plugin). My initial thought was to return the data as Xml, then process accordingly. Then this increases processing required in Javascript, to populate the page. I am trying to balance flexible, clear and simple. Thanks in advance for your knowledge and information.

    Read the article

  • return false is not working in my submit click

    - by kumar
    Hello friends. this is the code i am using for my Html.BeginForm.. $('#PbtnSubmit').click(function() { $('#PricingEditExceptions input[name=PMchk]').each(function() { if ($("#PricingEditExceptions input:checkbox:checked").length > 0) { var checked = $('#PricingEditExceptions input[type=checkbox]:checked'); var PMstrIDs = checked.map(function() { return $(this).val(); }).get().join(','); $('#1_exceptiontypes').attr('value', exceptiontypes) $('#1_PMstrIDs').attr('value', PMstrIDs); } else { alert("Please select atleast one exception"); return false; } }); }); in else blcok my return false is not working after alert mesage also its going to my controler? thanks is this right? i tried like this $('#PbtnSubmit').click(function() { $('#PricingEditExceptions input[name=PMchk]').each(function() { if ($("#PricingEditExceptions input:checkbox:checked").length > 0) { var checked = $('#PricingEditExceptions input[type=checkbox]:checked'); var PMstrIDs = checked.map(function() { return $(this).val(); }).get().join(','); $('#1_exceptiontypes').attr('value', exceptiontypes) $('#1_PMstrIDs').attr('value', PMstrIDs); } else { alert("Please select atleast one exception"); } }); return false; }); if i do like this on submit its doing nothing.. thanks

    Read the article

  • Function return type style

    - by JB
    I'm learning c++0x, at least the parts supported by the Visual C++ Express 2010 Beta. This is a question about style rather than how it works. Perhaps it's too early for style and good practice to have evolved yet for a standard that isn't even released yet... In c++0x you can define the return type of a method using - type at the end of the function instead of putting the type at the start. I believe this change in syntax is required due to lambdas and some use cases of the new decltype keyword, but you can use it anywhere as far as I know. // Old style int add1(int a, int b) { return a + b; } // New style return type auto add2(int a, int b) -> int { return a + b; } My question really then, is given that some functions will need to be defined in the new way is it considered good style to define all functions in this way for consistency? Or should I stick to only using it when necessary?

    Read the article

  • IF/ELSE makes stored procedure not return a result set

    - by Brendan Long
    I have a stored procedure that needs to return something from one of two databases: IF @x = 1 SELECT @y FROM Table_A ELSE IF @x = 2 SELECT @y FROM Table_B Either SELECT alone will return what I want, but adding the IF/ELSE makes it stop returning anything. I tried: IF @x = 1 RETURN SELECT @y FROM Table_A ELSE IF @x = 2 RETURN SELECT @y FROM Table_B But that causes a syntax error. The two options I see are both horrible: Do a UNION and make sure that only one side has any results: SELECT @y FROM Table_A WHERE @x = 1 UNION SELECT @y FROM Table_B WHERE @x = 2 Create a temporary table to store one row in, and create and delete it every time I run this procedure (lots). Neither solution is elegant, and I assume they would both be horrible for performance (unless MS SQL is smart enough not to search the tables when the WHERE class is always false). Is there anything else I can do? Is option 1 not as bad as I think?

    Read the article

  • Catching the return of main function before it deallocates resources

    - by EpsilonVector
    I'm trying to implement user threads in Linux kernel 2.4, and I ran into something problematic and unexpected. Background: a thread basically executes a single function and dies, except that when I call thread_create for the first time it must turn main() into a thread as well (by default it is not a thread until the first call, which is also when all the related data structures are allocated). Since a thread executes a function and dies, we don't need to "return" anywhere with it, but we do need to save the return value to be reclaimed later with thread_join, so the hack I came up with was: when I allocate the thread stack I place a return address that points to a thread_return_handler function, which deallocates the thread, makes it a zombie, and saves its return value for later. This works for "just run a function and die" threads, but is very problematic with the main thread. Since it actually is the main function, if it returns before the other threads finish the normal return mechanism kicks in, and deallocates all the shared resources, thus screwing up all the running threads. I need to keep it from doing that. Any ideas on how it can be done?

    Read the article

  • Avoid using InetAddress - Getting a raw IP address in network byte order

    - by Mylo
    Hey, I am trying to use the MaxMind GeoLite Country database on the Google App Engine. However, I am having difficulty getting the Java API to work as it relies on the InetAddress class which is not available to use on the App Engine. However, I am not sure if there is a simple workaround as it appears it only uses the InetAddress class to determine the IP of a given hostname. In my case, the hostname is always an IP anyway. What I need is a way to convert an IP address represented as a String into a byte array of network byte order (which the addr.getAddress() method of the InetAddress class provides). This is the code the current API uses, I need to find a way of removing all references to InetAddress whilst ensuring it still works! Thanks for your time. /** * Returns the country the IP address is in. * * @param ipAddress String version of an IP address, i.e. "127.0.0.1" * @return the country the IP address is from. */ public Country getCountry(String ipAddress) { InetAddress addr; try { addr = InetAddress.getByName(ipAddress); } catch (UnknownHostException e) { return UNKNOWN_COUNTRY; } return getCountry(bytesToLong(addr.getAddress())); }

    Read the article

  • Can't return nil, but zero value of slice

    - by Sergi
    I am having the case in which a function with the following code: func halfMatch(text1, text2 string) []string { ... if (condition) { return nil // That's the final code path) } ... } is returning []string(nil) instead of nil. At first, I thought that perhaps returning nil in a function with a particular return type would just return an instance of a zero-value for that type. But then I tried a simple test and that is not the case. Does anybody know why would nil return an empty string slice?

    Read the article

  • Return http 204 "no content" to client in ASP.NET MVC2

    - by Jeremy Raymond
    In an ASP.net MVC 2 app that I have I want to return a 204 No Content response to a post operation. Current my controller method has a void return type, but this sends back a response to the client as 200 OK with a Content-Length header set to 0. How can I make the response into a 204? [HttpPost] public void DoSomething(string param) { // do some operation with param // now I wish to return a 204 no content response to the user // instead of the 200 OK response }

    Read the article

  • What tools can I use to locate the IP of a machine on my network?

    - by user134918
    I am logged in to a remote Windows Server machine and am trying to attach it to a VPN for a LAN that I am also connected to locally from another Windows machine using Remotr Desktop. I can connect the remote machine to the VPN but when I do so, I lose my remote desktop connection. I am now in a situation where I know/think that the remote machine is on my LAN, but do not know what its current IP is and can therefor not connect to it again. I do not have any control over the infrastructure, all I have is a remote machine that I do control, and another machine that I also control that is connected to the same LAN as I'm trying to get the remote machine on using the existing VPN. What tools are available for Windows to allow me to locate the machine on my LAN again? I am imagining that there must be a tool that broadcasts the machines new IP using multicast, or tries to log in to a server component running somewhere with a know IP. Effectively, I am looking for some software that I can run on my remote machine, as well as my local machine, to allow me to discover the new IP address (on the LAN) assigned to the remote machine after connecting to the VPN.

    Read the article

  • Perl, Net::Traceroute::PurePerl return value

    - by John R
    This is a sub routine that I copied from CPAN. It works fine as it is when I run it from the command line. I have a similar function from Net::Traceroute that also works fine AND allows me to return the string with a SOAP call. The problem comes when I try to return the ~string(?) from the function below with a SOAP call. sub tr { use Net::Traceroute::PurePerl; my $t = new Net::Traceroute::PurePerl( backend => 'PurePerl', # this optional host => 'www.whatever.com', debug => 0, max_ttl => 30, query_timeout => 2, packetlen => 40, protocol => 'udp', # Or icmp ); $t->traceroute; $t->pretty_print; return $t; #print $t; } The output looks like a string except the last part of the string looks like this: 28 * * * 29 * * * 30 * * * Net::Traceroute::PurePerl=HASH(0x11fa6bf0) I don't know what is different about Net::Traceroute::PurePerl that won't allow me to return the value with SOAP since the Net::Traceroute version does allow me to return it with SOAP.

    Read the article

  • Jquery return value

    - by Anton
    I used a code: jQuery.fn.MyFunction = function(){ return this.each(function() { attributes = "test"; return attributes; });} But when I call var1 = $(this).MyFunction();alert(var1); I got an [object], but not the "test". How to allow jquery plugin return a some value?

    Read the article

  • A function that can make caller return

    - by icando
    I am writing some BASH script and I want it have some error handling mechanism: function f() { command1 || { echo "command1 failed"; return 1; } command2 || { echo "command2 failed"; return 1; } command3 || { echo "command3 failed"; return 1; } command4 || { echo "command4 failed"; return 1; } } I want to make this repetitive structure more readable by defining some function: function print_and_return() { echo "$@" # some way to exit the caller function } so that I can write function f as function f() { command1 || print_and_return "command1 failed" command2 || print_and_return "command2 failed" command3 || print_and_return "command3 failed" command4 || print_and_return "command4 failed" } What's the best way to achieve this? Thanks.

    Read the article

  • Fast file search algorithm for IP addresses

    - by Dave Jarvis
    Question What is the fastest way to find if an IP address exists in a file that contains IP addresses sorted as: 219.93.88.62 219.94.181.87 219.94.193.96 220.1.72.201 220.110.162.50 220.126.52.187 220.126.52.247 Constraints No database (e.g., MySQL, PostgreSQL, Oracle, etc.). Infrequent pre-processing is allowed (see possibilities section) Would be nice not to have to load the file each query (131Kb) Uses under 5 megabytes of disk space File Details One IP address per line 9500+ lines Possible Solutions Create a directory hierarchy (radix tree?) then use is_dir() (sadly, this uses 87 megabytes)

    Read the article

  • comparing actual IP with partial IP in PHP

    - by aslum
    Using PHP I'd like to compare an actual ip address to part of one, and see if it matches. For example I want to see if the address matches 12.34.. <?php $rem_address = getenv('REMOTE_ADDR'); $temp = substr ($rem_address,0,6) if ($temp == "12.34.") echo "It's a match"; ?> Is there an easier/better way to do this?

    Read the article

  • Windows equalivalent to eth0

    - by Justin Fuller
    Is there a generic IP device name for windows similar to "eth0" used by Linux and Solaris? I am attempting to monitor SCTP traffic, which appears to be successful passing the ip address, but this means for every machine to use this application would changing to use the host address. Thanks

    Read the article

  • In Ruby, how does one get their IP octet without going through DNS?

    - by user30997
    I can, on some of my systems, get my IP address (192.68.m.n format) by doing this: addr = IPSocket::getAddress(Socket.gethostname()) ...the trouble is that this only works if the name the local machine uses for itself is the name the DNS server associates with it. How *&#( hard can it be for ruby to just return its primary interface's IP address? I have to do this in a platform-independant way or I'd just call ifconfig or ipconfig and parse it.

    Read the article

  • send and recive packet in the Lan with multiple mac Addresses in C#

    - by MGH
    Hi , in our Network bandwith assign to mac address and if you can get more than one , you can get more bandwith :) if there any application or class in C# that can do this .... I'm already have the http proxy or port maper to send packets in different ip addresses but because of they are use same mac address it won't work . Any help is appreciated .

    Read the article

  • How to return 404 from Apache2 CGI program

    - by fastmonkeywheels
    I'm using mod_rewrite to redirect all incoming requests to a CGI application. I now need to have the application return a 404 if the requested file isn't found. How can I go about this from my program? The first line sent is the content-type while it's the line before that that usually indicates the status (200/404/500, etc).

    Read the article

  • Apache2 return 404 for proxy requests before reaching WSGI

    - by Alejandro Mezcua
    I have a Django app running under Apache2 and mod_wsgi and, unfortunately, lots of requests trying to use the server as a proxy. The server is responding OK with 404 errors but the errors are generated by the Django (WSGI) app, which causes a high CPU usage. If I turn off the app and let Apache handle the response directly (send a 404), the CPU usage drops to almost 0 (mod_proxy is not enabled). Is there a way to configure Apache to respond directly to this kind of requests with an error before the request hits the WSGI app? I have seen that maybe mod_security would be an option, but I'd like to know if I can do it without it. EDIT. I'll explain it a bit more. In the logs I have lots of connections trying to use the server as a web proxy (e.g. connections like GET http://zzz.zzz/ HTTP/1.1 where zzz.zzz is an external domain, not mine). This requests are passed on to mod_wsgi which then return a 404 (as per my Django app). If I disable the app, as mod_proxy is disabled, Apache returns the error directly. What I'd finally like to do is prevent Apache from passing the request to the WSGI for invalid domains, that is, if the request is a proxy request, directly return the error and not execute the WSGI app. EDIT2. Here is the apache2 config, using VirtualHosts files in sites-enabled (i have removed email addresses and changed IPs to xxx, change the server alias to sample.sample.xxx). What I'd like is for Apache to reject any request that doesn't go to sample.sample.xxx with and error, that is, accept only relative requests to the server or fully qualified only to the actual ServerAlias. default: <VirtualHost *:80> ServerAdmin [email protected] ServerName X.X.X.X ServerAlias X.X.X.X DocumentRoot /var/www/default <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options FollowSymLinks AllowOverride None Order allow,deny allow from all </Directory> ErrorDocument 404 "404" ErrorDocument 403 "403" ErrorDocument 500 "500" ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> actual host: <VirtualHost *:80> ErrorDocument 404 "404" ErrorDocument 403 "403" ErrorDocument 500 "500" WSGIScriptAlias / /var/www/sample.sample.xxx/django.wsgi ServerAdmin [email protected] ServerAlias sample.sample.xxx ServerName sample.sample.xxx CustomLog /var/www/sample.sample.xxx/log/sample.sample.xxx-access.log combined Alias /robots.txt /var/www/sample.sample.xxx/static/robots.txt Alias /favicon.ico /var/www/sample.sample.xxx/static/favicon.ico AliasMatch ^/([^/]*\.css) /var/www/sample.sample.xxx/static/$1 Alias /static/ /var/www/sample.sample.xxx/static/ Alias /media/ /var/www/sample.sample.xxx/media/ <Directory /var/www/sample.sample.xxx/static/> Order deny,allow Allow from all </Directory> <Directory /var/www/sample.sample.xxx/media/> Order deny,allow Allow from all </Directory> </VirtualHost>

    Read the article

  • Is it possible to configure a CDN so that it will step out of the way for a subset of regional IPs?

    - by rwired
    We have a website which targets customers in China, both expat and local Chinese. We have an ICP license which allows us to host in a datacenter inside China. Internet in China is actually as fast as anywhere else (faster than most places actually), so long as the content is served-up within the boundaries of the Great-Firewall. Anything that crosses the wall is horribly slow. The problem is that most expats have some sort of VPN installed so that they can access all the blocked stuff. What this means is that when they access our site, the traffic first has to go out of China through the firewall to their VPN, and then back in. The performance is terrible, worse than if we were just hosting outside of China directly (which we used to do before the ICP was issued). So I want to use a global CDN to mirror the site automatically, but I only want to deliver the content via the CDN if the user's request IP address is outside of China. Inside China I would like the content to be served by our own server. I also want to be careful with the domain names. We currently use www.xxx.com and www.xxx.cn for language selection purposes, as these perform well in SEO on Google (which the expats use), and Baidu (which the locals use). If possible I would like to avoid having one domain on the outside, and the other on the inside since not all expats use a VPN, and some Chinese speakers also use VPNs. Also some of our legitimate customers in both languages are from outside of China. I also don't want to resort to using something like www2.xxx.com/cn for the outside connection if at all possible, since I have worries about duplicate content and canonical URLs ruining our SEO (unless you know of a quick fix for that). CDNs I'm considering are: Google PageSpeed, CloudFlare, Amazon CloudFront. None of which have datacenters inside China. I have complete control of the .com DNS zone records, but the .cn zones are under the control of the domain issuing body in China. I'm not sure at this time if they would allow even a CNAME to point to an IP outside of China (although I don't see why not). They no longer allow outside registrars like they used to.

    Read the article

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