Search Results

Search found 2043 results on 82 pages for 'collision detection'.

Page 33/82 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • Customizing detection change

    - by mada
    Hi, I can now if a session contain any changes which must be synchronized with the database with session.isDirty() But i have a simple field (modification date) that i would like to be ignore by it. Example: object Person( name,age,datemodification). if i just modify the datemodification field i would like that session.isDirty() or othermethod like this to return false so at the end no sql update will occur. Thanks in advance. Regards

    Read the article

  • Flag bit computation and detection

    - by Majid
    Hi all, In some code I'm working on I should take care of ten independent parameters which can take one of two values (0 or 1). This creates 2^10 distinct conditions. Some of the conditions never occur and can be left out, but those which do occur are still A LOT and making a switch to handle all cases is insane. I want to use 10 if statements instead of a huge switch. For this I know I should use flag bits, or rather flag bytes as the language is javascript and its easier to work with a 10 byte string with to represent a 10-bit binary. Now, my problem is, I don't know how to implement this. I have seen this used in APIs where multiple-selectable options are exposed with numbers 1, 2, 4, 8, ... , n^(n-1) which are decimal equivalents of 1, 10, 100, 1000, etc. in binary. So if we make call like bar = foo(7), bar will be an object with whatever options the three rightmost flags enable. I can convert the decimal number into binary and in each if statement check to see if the corresponding digit is set or not. But I wonder, is there a way to determine the n-th digit of a decimal number is zero or one in binary form, without actually doing the conversion?

    Read the article

  • java string detection of ip

    - by user384706
    Hi, Assume a java string that contains an IP (v4 or v6) or a hostname. What is the best way to detect among these cases? I am not interested so much on whether the IP is in valid range (e.g. 999.999.999.999 for IPv4). I am interested in just a way to detect if a String is a hostname or an IP (v4 or v6). Initially I though this: if(theString.indexOf("@")!=-1){ //Not an Ip } but I am not sure if I should always expect a format containing @ always. Thanks

    Read the article

  • CSS overflow detection in JavaScript

    - by ring0
    In order to display a line of text (like in a forum), and end that line with "..." if the text would overflow the line (not truncating using the CSS overflow property), there are a number of ways. I'm still seeking the best solution. For instance, Adding in CSS a "..." as a background-image is a possibility, but it would appear all the time, and this is not a good solution. Some sites just count the characters and if over - say - 100, truncates the string to keep only 100 (or 97) chars and add a "..." at the end. But fonts are usually not proportional, so the result is not pretty. For instance the space - in pixels - taken by "AAA" and "iii" is clearly different "AAA" and "iii" via a proportional font have the same width There is another idea to get the exact size in pixels of the string: create in Javascript a DIV insert the text in it (via innerHTML for instance) measure the width (via .offsetWidth) which is not implemented yet. However, I wonder if there could be any browser compatibility problem? Did any one tried this solution? Other recommendations would be welcome.

    Read the article

  • Detection of negative integers using bit operations

    - by Nawaz
    One approach to check if a given integer is negative or not, could be this: (using bit operations) int num_bits = sizeof(int) * 8; //assuming 8 bits per byte! int sign_bit = given_int & (1 << (num_bits-1)); //sign_bit is either 1 or 0 if ( sign_bit ) { cout << "given integer is negative"<<endl; } else { cout << "given integer is positive"<<endl; } The problem with this solution is that number of bits per byte couldn't be 8, it could be 9,10, 11 even 16 or 40 bits per byte. Byte doesn't necessarily mean 8 bits! Anyway, this problem can be easily fixed by writing, //CHAR_BIT is defined in limits.h int num_bits = sizeof(int) * CHAR_BIT; //no assumption. It seems fine now. But is it really? Is this Standard conformant? What if the negative integer is not represented as 2's complement? What if it's representation in a binary numeration system that doesn't necessitate only negative integers to have 1 in it's most significant bit? Can we write such code that will be both portable and standard conformant? Related topics: Size of Primitive data types Why is a boolean 1 byte and not 1 bit of size?

    Read the article

  • C# IE Proxy Detection not working from a Windows Service

    - by mytwocents
    This is very odd. I've written a windows form tool in C# to return the default IE proxy. It works (See code snippets below). I've created a service to return the proxy using the same code, it works when I step into the debugger, BUT it doesn't work when the service is running as binary code. This must be some sort of permissions or context thing that I cannot recreate. Further, if I call the tool from the windows service, it still doesn't return the proxy information.... this seems isolated to the service somehow. I don't see any permission errors in the events log, it's as if a service has a totally different context than a regular windows form exe. I've tride both: WebRequest.GetSystemWebProxy() and Uri requestUri = new Uri(urlOfDomain); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUri); IWebProxy proxy = request.Proxy; if (!proxy.IsBypassed(requestUri)){ Uri uri2 = proxy.GetProxy(request.RequestUri); } Thanks for any help!

    Read the article

  • Hit detection on non-transparent pixel

    - by Abie
    Given a PNG in a web context with some transparent pixels and some non-transparent pixels, is there a way in Javascript to determine if a user has clicked on a non-transparent pixel? A webkit-only solution would be perfectly acceptable.

    Read the article

  • Connection Timeout Extension/Detection

    - by ircmaxell
    Well, let me start off by explaining what I'm trying to do. I have an application that stalls a HTTP connection until new data is available (sometimes a few seconds, sometimes 30 minutes or so). Right now, the system works fine if the data is sent within a few minutes. The problem I'm facing, is that it doesn't seem that XHR recognizes a dropped connection... So instead of killing the current connection and reconnecting when it detects a dropped connection, it just sits there. I'd really not like to have it force-reconnect every minute or two (That's one reason this app was written, to stop the need for polling). So, my questions are as follows: Is there a way to detect a dropped (not closed) TCP connection with XHR? Is there a way that I can tell XHR not to timeout (I saw IE8 has the .timeout property) Would it be better to send a header (or some other content) every now and then (say once per minute) down the pipe to keep the connection open? Thanks.

    Read the article

  • PHP: URL detection (regexp) includes line breaks

    - by marco92w
    I want to have a function which gets a text as the input and gives back the text with URLs made to HTML links as the output. My draft is as follows: function autoLink($text) { return preg_replace('/https?:\/\/[\S]+/i', '<a href="\0">\0</a>', $text); } But this doesn't work properly. For the input text which contains ... http://www.google.de/ ... I get the following output: <a href="http://www.google.de/<br">http://www.google.de/<br</a> /> Why does it include the line breaks? How could I limit it to the real URL? Thanks in advance!

    Read the article

  • Sql Server XML-type column duplicate entry detection

    - by aaaa bbbb
    In Sql Server I am using an XML type column to store a message. I do not want to store duplicate messages. I only will have a few messages per user. I am currently querying the table for these messages, converting the XML to string in my C# code. I then compare the strings with what I am about to insert. Unfortunately, Sql Server pretty-prints the data in the XML typed fields. What you store into the database is not necessarily exactly the same string as what you get back out later. It is functionally equivalent, but may have white space removed, etc. Is there an efficient way to compare an XML string that I am considering inserting with those that are already in the database? As an aside, if I detect a duplicate I need to delete the older message then insert the replacement.

    Read the article

  • Textarea onchange detection

    - by teepusink
    Hi, How do I detect change event on textarea using javascript? I'm trying to detect how many characters left is available as you type. I tried using the onchange event, but that seems to only kick in when focus is out. Thanks, Tee

    Read the article

  • Console App Mouse-Click X Y Coordinate Detection/Comparison

    - by Bloodyaugust
    I have a game that I am working on in a C# console application, purely as practice before going on to better methods. As opposed to using something such as a Windows Forms App, which has button functionality built in, I am endeavoring to grab the cursor position (which I know how to do) and compare it to a number of area's inside a console application as defined by perhaps pixel location, but I also do not know if there is some sort of built in unit of space other than pixels (this last bit is the part I am unable to figure). P.S. I know this is in general terms, with no code already provided, but I do not feel that it is needed as all I am asking for is a brief explanation of how to grab X Y coordinates inside a console application, and stick them in int variables. Many Thanks in advance! :D

    Read the article

  • 404 detection in JavaScript

    - by Vadim
    In my JavaScript I'm trying to redirect to third party page. It can open a page either in a new window or inside a frame depends on a user settings. Something like this: if (newWindow) { window.open(url, targer); } else { theFrame = url; } What I want to do is to display my custom page in case a third party site is down or page is unavailable. Basically in case of 404 error. What's the best way to solve this problem?

    Read the article

  • Datastructure choices for highspeed and memory efficient detection of duplicate of strings

    - by Jonathan Holland
    I have a interesting problem that could be solved in a number of ways: I have a function that takes in a string. If this function has never seen this string before, it needs to perform some processing. If the function has seen the string before, it needs to skip processing. After a specified amount of time, the function should accept duplicate strings. This function may be called thousands of time per second, and the string data may be very large. This is a highly abstracted explanation of the real application, just trying to get down to the core concept for the purpose of the question. The function will need to store state in order to detect duplicates. It also will need to store an associated timestamp in order to expire duplicates. It does NOT need to store the strings, a unique hash of the string would be fine, providing there is no false positives due to collisions (Use a perfect hash?), and the hash function was performant enough. The naive implementation would be simply (in C#): Dictionary<String,DateTime> though in the interest of lowering memory footprint and potentially increasing performance I'm evaluating a custom data structures to handle this instead of a basic hashtable. So, given these constraints, what would you use? EDIT, some additional information that might change proposed implementations: 99% of the strings will not be duplicates. Almost all of the duplicates will arrive back to back, or nearly sequentially. In the real world, the function will be called from multiple worker threads, so state management will need to be synchronized.

    Read the article

  • UIView surface Detection

    - by Sanjay Darshil
    In my code I crated two UIView View1 and View2 out of which View2 rotates on finger touch using CGAffineTransform and View1 is drawn like Arrow shaped (triangle) using CGContext. The View1 is steady view (fixed) which Points (shown directed Up) to the Surface of View2 , So I want to detect the View2 surface points when it stopped rotation and appears in front of the view1. How can I made this possible to detect the UIView Surface when it appears in front of another UIView?

    Read the article

  • PopUp Blocker code detection not working.

    - by httpftp21
    I have turned on PopUp blocker in FF and Chrome. I have a piece of code to check PopUp is working as: [Code] function checkPopUp() { var myTest = window.open("about:blank","","directories=no,height=1,width=1,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no"); var popUpsBlocked = ''; if (!myTest) { popUpsBlocked = true; } else { popUpsBlocked = false; } return popUpsBlocked; } [/Code] its working fine "onload" of the page. But when i am using it with hyper link onclick, its not working a popup is getting opened. [code] Test [/code]

    Read the article

  • Python frequency detection

    - by Tsuki
    Ok what im trying to do is a kind of audio processing software that can detect a prevalent frequency an if the frequency is played for long enough (few ms) i know i got a positive match. i know i would need to use FFT or something simiral but in this field of math i suck, i did search the internet but didn not find a code that could do only this. the goal im trying to accieve is to make myself a custom protocol to send data trough sound, need very low bitrate per sec but im also very limited on the transmiting end so the recieving software will need to be able custom (cant use an actual hardware/software modem) also i want this to be software only (no additional hardware except soundcard) thanks alot for the help.

    Read the article

  • Cross domain iframe content load detection

    - by fpb
    I have a rather interesting problem. I have a parent page that will create a modal jquery dialog with an iframe contained within the dialog. The iframe will be populated with content from a 3rd party domain. My issue is that I need to create some dialog level javascript that can detect if the content of the iframe loaded successfully and if it hasn't within a 5 second time frame, then to close the dialog and return the user to the parent page. I have researched numerous solutions and only two are of any true value. Get the remote site to include a javascript line of document.domain = 'our-domain.com'. Use a URL Fragment hack, but again I would need the request that the remote site able to modify the URL by appending '#some_value' to the end of the URL and my dialog window would have to poll the URL until it either sees it or times out. Are these honestly the only options I have to work with? Is there not a simpler way to just detect this? I have been researching if there's a way to poll for http response errors, but this still remains confined to the same restrictions. Any help would be immensely appreciated. Thanks

    Read the article

  • Custom QAction/QMenu for mouse button detection

    - by voodoogiant
    I'm trying to create a popup menu, where I can detect the mouse button that was pressed for a given item. I've created a custom QAction already to build my QMenu, but the triggered signal when the menu item is pressed doesn't provide a QMouseEvent for me to query the button pressed. Also, I'm setting the a status tip for each QAction, which appears in the status bar when I mouse over it, but it stays even after I close the QMenu. Is this normal behavior?

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >