Search Results

Search found 18596 results on 744 pages for 'c how to detect all ip addresses from a lan'.

Page 135/744 | < Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >

  • Can Perl detect arrays?

    - by Sandra Schlichting
    I have this script #!/usr/bin/perl use warnings; use strict; use Data::Dumper; my %x1 = (); $x1{"a"} = "e"; my %x2 = (); $x2{"a"} = ["b","c"]; p(\%x1); p(\%x2); sub p { my $x = shift @_; print $x->{a}; print "\n"; } which outputs e ARRAY(0x2603fa0) The problem is I don't know when the input is an array or a scalar, and when it is an array I would like to print those values as well. Can p be modified to do this?

    Read the article

  • localhost/live - detect by HTTP_HOST

    - by Adam Kiss
    Hello, let's say I develop locally and debug small things on live server. Is it good idea to have something like this in my code? : $is_local = (strpos($_SERVER['http_host'], 'localhost') !== false); define ('DEBUG',$is_local); And then use it through my code, when setting stuff? $mysql_settings = (DEBUG) ? array(/*localhost settings*/) : array(/*live settings*/); This way, I can use the same files live and on localhost, so I can sync without any fear of having wrong e.g. connection settings on live server. Is it good or wrong idea?

    Read the article

  • How to detect that a process is started using C# code[windows service]

    - by infant programmer
    I am trying to design a windows-service which monitors a process namely "Gtalk", if the process is started then, the browser Internet-explorer (process iexplore) should be closed. This should happen only when the process "Gtalk" is started, [not when running] The code I have written and implemented, doesn't allow to open IExplore when Gtalk is running. That is certainly what not I am trying for. The process Gtalk should close browser only at its start-up, After the process is started, it should allow to open IExplore. Is it possible with Windows service or is it must be the part of Gtalk process itself? This is my code: while (true) { if (Process.GetProcessesByName("Gtalk").Length > 0) { foreach (Process prc in Process.GetProcessesByName("IExplore")) { prc.Kill(); } } }

    Read the article

  • Facebook API - Detect if session is active OR NOT active

    - by Tom Doe
    I'm sure I'm simply overlooking something in the Facebook API docs. Basically, after I've loaded the FB Graph, I need to know if the session is active... I cannot simply assume they're logged out and simply re-render if they're logged in once the 'auth.statusChange' event is triggered. I need to know right off the bat. Below is the code that I've used. Most importantly the FB.getLoginStatus/getAuthResponse/getAccessToken don't work like I'd expect; essentially where it indicates, when invoked, whether they're logged in or out. (function(d) { // Create fb-root var fb_root = document.createElement('div'); fb_root.id = "fb-root"; document.getElementsByTagName('body')[0].appendChild( fb_root ); // Load FB Async var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); // App config-data var config = { appId : XXXX, cookie: true, status: true, frictionlessRequests: true }; window.fbAsyncInit = function() { // This won't work. // I can't assume they're logged out and rely on this to tell me they're logged in. FB.Event.subscribe('auth.statusChange', function(response) {}); // Init FB.init(config); // These do not inidicate if the user is logged out :( FB.getLoginStatus(function(response) { }); FB.getAuthResponse(function(response) { }); FB.getAccessToken(function(response) { }); }; }(document)); Any help is much appreciated. :)

    Read the article

  • X11, how to detect I’m the last window/application on the display

    - by ts
    I have an x11 display with a windowmanager (sadly not a specific one, could be twm, dtwm, mwm, metacity …) , myApp and other applications with windows. I want to close the display if the other applications are closed and myApp is the only one with windows on the display. I do know the windows of myApp, but how do I distinguish between the windows of the windowmanger and of the other applications. I’m currently polling with xwininfo -tree -root -children and comparing this to what I’m expecting, but this only works in a ‘well defined’ environment. It seems that many of the above mentioned windowmanager don’t support EWMH.

    Read the article

  • PHP detect if page is reloaded with PHP_SELF

    - by FFish
    I have a form that reloads the page with the updated data: <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> ... <input type="submit" name="Submit" value="Update data"> </form> When the page is updated I want to display a message "Data updated". There was something like this with Referer I beleve, but can't remember. btw I am also using: if (isset($_POST['Submit'])) { // prevent resending data header("Location: " . $_SERVER['PHP_SELF']); } to avoid the annoying resending data message when the user clicks the back button. Is this correct?

    Read the article

  • detect when a webpage is updated

    - by Martin Trigaux
    Hello, There is a website (very simple) which will be updated soon and I'd like to receive an alert at the moment it changes (like a sound, a popup,...) I guess I should send request every x minutes and compare the result with what's now but I don't know how to do that. I don't really care about the language used, I know java, python, php, a bit of c and bash (I'm on linux)... Thank you

    Read the article

  • How to detect if an element exists in Watir

    - by Rijksband
    Hi, I'm relatively new to Watir but can find no good documentation (examples) regarding how to check if an element exists. There are the API specs, of course, but these make precious little sense to me if I don't find an example. I've tried both combinations but nothing seems to work... if browser.image (:src "/media/images/icons/reviewertools/editreview.jpg").exists then... if browser.image (:src "/media/images/icons/reviewertools/editreview.jpg").exists? then... If anyone has a concrete suggestion as per how to implement this, please help! Thanks!

    Read the article

  • How to detect invalid image URL with JAVA?

    - by Cataclysm
    I have a method to download image from URL. As like below.. public static byte[] downloadImageFromURL(final String strUrl) { InputStream in; ByteArrayOutputStream out = new ByteArrayOutputStream(); try { URL url = new URL(strUrl); in = new BufferedInputStream(url.openStream()); byte[] buf = new byte[2048]; int n = 0; while (-1 != (n = in.read(buf))) { out.write(buf, 0, n); } out.close(); in.close(); } catch (IOException e) { return null; } return out.toByteArray(); } I have an image url and it is valid. for example. https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTxfYM-hnD-Z80tgWdIgQKchKe-MXVUfTpCw1R5KkfJlbRbgr3Zcg My problem is I don't want to download if image is really not exists.Like .... https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTxfYM-hnD-Z80tgWdIgQKchKe-MXVUfTpCw1R5KkfJlbRbgr3Zcgaaaaabbbbdddddddddddddddddddddddddddd This image shouldn't be download by my method. So , how can I know the giving image URL is not really exists. I don't want to validate my URL (I think that may not my solution ). So, I googled for that. From this article ... How to check if a URL exists or returns 404 with Java? and Java check if file exists on remote server using its url But this con.getResponseCode() will always return status code "200". This mean my method will also download invalid image urls. So , I output my bufferStream as like... System.out.println(in.read(buf)); Invalid image URL produces "43". So , I add these lines of codes in my method. if (in.read(buf) == 43) { return null; } It is ok. But I don't think that will always satisfy. Has another way to get it ? am I right? I would really appreciate any suggestions. This problem may struct my head. Thanks for reading my question.

    Read the article

  • WCF, Metadata and BIGIP - Can I force the correct url for the WSDL items?

    - by Yossi Dahan
    We have a WCF service hosted on ServerA which is a server with no-direct Internet access and has a non-Internet routable IP address. The service is fronted by BIGIP which handles SSL encryption and decryption and forwards the unencrypted request to ServerA (at the moment it does NOT actually do any load balancing, but that is likely to be added in the future) on a specific port. What that means is that our clients would be calling the service through https://www.OurDomain.com/ServiceUrl and would get to our service on http://SeverA:85/ServiceUrl through the BIGIP device; When we browse to the WSDL published on https://www.OurDomain.com/ServiceUrl all the addresses contained in the WSDL are based on the http://SeverA:85/ServiceUrl base address We figured out that we could use the host headers setting to set the domain, but our problem is that while this would sort out the domain, we would still be using the wrong scheme – it would use http://www.OurDomain.com/ServiceUrl while we need it to be Https. Also – as we have other services (asmx based) hosted on that server we had some issues setting the host headers, and so we thought we could get away with creating another site on the server (using, say, port 82) and set the host header on that; now, on top of the http/https problem we have an issue as the WSDL contains the port number in all the urls, where BigIP works on port 443 (for the SSL) Is there a more flexible solution than implementing Host Headers? Ideally we need to retain flexibility and ease of supportability. Thanks for any help…

    Read the article

  • Block facebook from my website

    - by Joseph Szymborski
    I have a secure link direction service I'm running (expiringlinks.co). If I change the headers in php to redirect my visitors, then facebook is able to show a preview of the website I'm redirecting to when users send links to one another via facebook. I wish to avoid this. Right now, I'm using an AJAX call to get the URL and javascript to redirect, but it's causing problems for users who don't use javascript. Here are a number of ways I'd like to block facebook, but I can't seem to get working: I've tried blocking the facebook bot (facebookexternalhit/1.0 and facebookexternalhit/1.1) but it's not working, I don't think they're using them for this functionality. I'm thinking of blocking the facebook IP addresses, but I can't find all of them, and I don't think it'll work unless I get all of them. I've thought of using a CAPTCHA or even a button, but I can't bring myself to do that to my visitors. Not to mention I don't think anyone would use the site. I've searched the facebook docs for meta tags that would "opt-me out", but haven't found one, and doubt that I would trust it if I had. Any creative ideas or any idea how to implement the ones above? Thank you so much in advance!

    Read the article

  • c++ connect() keeps returning WSATIMEDOUT over internet but not localy

    - by KaiserJohaan
    Hello, For some reason, my chat application always gets WSATIMEDOUT when trying to connect to another person over the internet. int len_ip = GetWindowTextLength(GetDlgItem(hWnd,ID_EDIT_IP)); char ipBuffer[16]; SendMessage(GetDlgItem(hWnd,ID_EDIT_IP),WM_GETTEXT,16,(LPARAM)ipBuffer); long host_ip = inet_addr(ipBuffer); int initializeConnection(long host_ip, HWND hWnd) { // initialize winsock WSADATA wdata; int result = WSAStartup(MAKEWORD(2,2),&wdata); if (result != 0) { return 0; } // setup socket tcp_sock = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); if (tcp_sock == INVALID_SOCKET) { return 0; } // setup socket address SOCKADDR_IN tcp_sock_addr; tcp_sock_addr.sin_family = AF_INET; tcp_sock_addr.sin_port = SERVER_TCP_PORT; tcp_sock_addr.sin_addr.s_addr = host_ip; // connect to server if (connect(tcp_sock,(SOCKADDR*)&tcp_sock_addr,sizeof(tcp_sock_addr)) == SOCKET_ERROR) { return 0; } HRESULT hr = WSAGetLastError(); // set socket in asynchronous mode if (WSAAsyncSelect(tcp_sock,hWnd,SOCKET_TCP, FD_READ | FD_WRITE | FD_CONNECT | FD_CLOSE) == SOCKET_ERROR) { return 0; } return 1; } For some reason it works perfectly fine on local network between computers, but totally screws up over the internet. WSATIMEDOUT is always returned (not connection refused, so its not a port problem). It makes me believe something is wrong with the IP but why on earth can it work on local addresses (like 192.168.2.4) Any ideas? Cheers

    Read the article

  • Use IPtables or null route for blacklisting about 1 million IP addresses?

    - by tylerl
    I've come across a situation where a client needs to blacklist a set of just under 1 million individual IP addresses (no subnets), and network performance is a concern. While I would conjecture that IPTables rules would have less of a performance impact than routes, that's just conjecture. Does anyone have any solid evidence or other justification for favoring either IPTables or null routing as solution for blacklisting long lists of IP addresses? In this case everything is automated, so ease-of-use isn't really a concern.

    Read the article

  • How to get client machine ip address in custom realm? [on hold]

    - by Sumit
    I want to get client machine ip address in my custom Realm when client attempt to login basically here is detail requirement of project User having role 'Admin' can add new users and assign multiple roles and permission ,and at the same time specify list of ip address and countries to restrict them to access website. All these information i am storing in database. So basically till now i am using shiro default 'authc' filter but now i want ip address of client machine and get country from where request is coming and check it against database and then and then only allow access to website. Any help..? Thanks and regards

    Read the article

  • What algorithms can I use to detect if articles or posts are duplicates?

    - by michael
    I'm trying to detect if an article or forum post is a duplicate entry within the database. I've given this some thought, coming to the conclusion that someone who duplicate content will do so using one of the three (in descending difficult to detect): simple copy paste the whole text copy and paste parts of text merging it with their own copy an article from an external site and masquerade as their own Prepping Text For Analysis Basically any anomalies; the goal is to make the text as "pure" as possible. For more accurate results, the text is "standardized" by: Stripping duplicate white spaces and trimming leading and trailing. Newlines are standardized to \n. HTML tags are removed. Using a RegEx called Daring Fireball URLs are stripped. I use BB code in my application so that goes to. (ä)ccented and foreign (besides Enlgish) are converted to their non foreign form. I store information about each article in (1) statistics table and in (2) keywords table. (1) Statistics Table The following statistics are stored about the textual content (much like this post) text length letter count word count sentence count average words per sentence automated readability index gunning fog score For European languages Coleman-Liau and Automated Readability Index should be used as they do not use syllable counting, so should produce a reasonably accurate score. (2) Keywords Table The keywords are generated by excluding a huge list of stop words (common words), e.g., 'the', 'a', 'of', 'to', etc, etc. Sample Data text_length, 3963 letter_count, 3052 word_count, 684 sentence_count, 33 word_per_sentence, 21 gunning_fog, 11.5 auto_read_index, 9.9 keyword 1, killed keyword 2, officers keyword 3, police It should be noted that once an article gets updated all of the above statistics are regenerated and could be completely different values. How could I use the above information to detect if an article that's being published for the first time, is already existing within the database? I'm aware anything I'll design will not be perfect, the biggest risk being (1) Content that is not a duplicate will be flagged as duplicate (2) The system allows the duplicate content through. So the algorithm should generate a risk assessment number from 0 being no duplicate risk 5 being possible duplicate and 10 being duplicate. Anything above 5 then there's a good possibility that the content is duplicate. In this case the content could be flagged and linked to the article's that are possible duplicates and a human could decide whether to delete or allow. As I said before I'm storing keywords for the whole article, however I wonder if I could do the same on paragraph basis; this would also mean further separating my data in the DB but it would also make it easier for detecting (2) in my initial post. I'm thinking weighted average between the statistics, but in what order and what would be the consequences...

    Read the article

  • How do I remotely enable the firewall on Server 2008 to exclude specific IP addresses?

    - by Guy
    Previously I was working with Server 2003 and managed to lock myself out of the server (I was accessing it remotely) by enabling the firewall. I want to remotely enable the firewall on Server 2008 without locking myself out of the server (access via RDP) and then selectively add IP addresses to the firewall to exclude. i.e. block specific IP addresses. Are there any step by step instructions on how to safely do this?

    Read the article

< Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >