Search Results

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

Page 128/744 | < Previous Page | 124 125 126 127 128 129 130 131 132 133 134 135  | Next Page >

  • Best way to programmatically detect iPad/iPhone hardware

    - by Adam Eberbach
    The reason I need to find out is that on an iPad, a UIPickerView has the same height in landscape orientation as it does in portrait. On an iPhone it is different. The iPad programming guide introduces an "idiom" value to UIDevice: UIDevice* thisDevice = [UIDevice currentDevice]; if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { // iPad } else { // iPhone } which works OK while you're in iPad (3.2) but not iPhone (3.1.3) - so it looks like there also needs to be an ifdef to conditionally compile that check, like: #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 30200 UIDevice* thisDevice = [UIDevice currentDevice]; if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) { // etc. } #endif To me that's starting to look very clumsy. What's a better way?

    Read the article

  • Detect browser focus/out-of-focus via Google Chrome Extension

    - by Paul
    Is there a way to find out if Google chrome is in focus or out of focus? I'm creating an app which needs to know if the user is currently using the browser or not. By tying the detection through the content script in a Google extension, I've tried using blur and focus but the problem is that clicking on the address bar also fires a blur event. Same goes for detecting mouse movement, where moving the mouse outside of the viewing area will not be detected. I've also tried looking at onFocusChanged but it seems it only detects changes in chromes' windows not apps outside of Chrome. Anyone have other ideas for this? Also, would this be any easier if I created an add-on for firefox instead? Thanks!

    Read the article

  • Detect Click into Iframe using JavaScript

    - by Russ Bradberry
    I understand that it is not possible to tell what the user is doing inside an iframe if it is cross domain. What I would like to do is track if the user clicked at all in the iframe. I imagine a scenario where there is an invisible div on top of the iframe and the the div will just then pass the click event to the iframe. Is something like this possible? If it is, then how would I go about it? The iframes are ads, so I have no control over the tags that are used.

    Read the article

  • Detect an Uninstall in a Launch Condition using Wix MSIs

    - by coxymla
    I've been playing around with Wix, making a little app with auto-generated installer and three versions to test the upgradability, 1.0, 1.1 and 2.0. 1.1 is meant to be able to upgrade from 1.0, and not to allow the user to install 1.1 if 1.1 is already present. <Upgrade Id="F30C4129-F14E-43ee-BD5E-03AA89AD8E07"> <UpgradeVersion Minimum="1.0.0" IncludeMinimum="yes" Maximum="1.0.0" IncludeMaximum="yes" Property="OLDERVERSIONBEINGUPGRADED" /> <UpgradeVersion Minimum="1.1.0" IncludeMinimum="yes" OnlyDetect="yes" Property="NEWERVERSIONDETECTED" /> </Upgrade> <Condition Message="A later version of [ProductName] is already installed. Setup will now exit."> NOT (NEWERVERSIONDETECTED OR Installed) </Condition> Problem #1: 1.1 can't be uninstalled, because the condition is set and checked during the uninstall. 2.0 is meant to be able to upgrade from 1.1, and not to upgrade from 1.0 ('too old'.) It shouldn't be able to install on top of itself either. <Upgrade Id="F30C4129-F14E-43ee-BD5E-03AA89AD8E07"> <UpgradeVersion Minimum="1.1.0" IncludeMinimum="yes" Maximum="1.1.0" IncludeMaximum="yes" Property="OLDERVERSIONBEINGUPGRADED" /> </Upgrade> <Upgrade Id="F30C4129-F14E-43ee-BD5E-03AA89AD8E07"> <UpgradeVersion Minimum="2.0.0" OnlyDetect="yes" Property="NEWERVERSIONDETECTED" /> </Upgrade> <Upgrade Id="F30C4129-F14E-43ee-BD5E-03AA89AD8E07"> <UpgradeVersion Minimum="1.0.0" IncludeMinimum="yes" Maximum="1.0.0" IncludeMaximum="yes" Property="TOOOLDVERSIONDETECTED" /> </Upgrade> <Condition Message="A later version of [ProductName] is already installed. Setup will now exit."> NOT NEWERVERSIONDETECTED OR Installed </Condition> <Condition Message="A version of [ProductName] that is already installed is too old to be upgraded. Setup will now exit."> NOT TOOOLDVERSIONDETECTED </Condition> Problem #2: If I try to upgrade from 1.1, I hit my modified later version condition. (Error: A later version of Main Application 1.1 is already installed. Setup will now exit.) Problem #3: The installer allows me to install 2.0 over the top of itself. What am I doing wrong with my Upgrade code and conditions to get these problems in my MSIs?

    Read the article

  • Detect blow in Mic and do something {iPhone SDK}

    - by Momeks
    Hi , i found this tutorial , and it's good , but doesn't work for me ! here is the code : - (void)listenForBlow:(NSTimer *)timer { [recorder updateMeters]; const double ALPHA = 0.05; double peakPowerForChannel = pow(10, (0.05 * [recorder peakPowerForChannel:0])); lowPassResults = ALPHA * peakPowerForChannel + (1.0 - ALPHA) * lowPassResults; if (lowPassResults > 0.95) NSLog(@"Mic blow detected"); //change the background color e.g ! } in the console show me the nslog reseult like this (without any bowling !): 2010-04-11 23:32:27.935 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:27.965 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:27.995 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:28.026 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:28.055 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:28.086 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:28.115 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:28.145 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:28.175 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:28.205 MicBlow[2358:207] Mic blow detected 2010-04-11 23:32:28.236 MicBlow[2358:207] Mic blow detected i change this value : if (lowPassResults < 0.95) to if (lowPassResults > 0.95) so it seems work ! but doesn't chage anything , again if i put the background changing code the , my code change background but without any bowling !! what's the problem ?

    Read the article

  • Best way to detect integer overflow in C/C++

    - by Chris Johnson
    I was writing a program in C++ to find all solutions of a^b = c (a to the power of b), where a, b and c together use all the digits 0-9 exactly once. The program looped over values of a and b, and ran a digit-counting routine each time on a, b and a^b to check if the digits condition was satisfied. However, spurious solutions can be generated when a^b overflows the integer limit. I ended up checking for this using code like: unsigned long b, c, c_test; ... c_test=c*b; // Possible overflow if (c_test/b != c) {/* There has been an overflow*/} else c=c_test; // No overflow Is there a better way of testing for overflow? I know that some chips have an internal flag that is set when overflow occurs, but I've never seen it accessed through C or C++.

    Read the article

  • iPhone SDK : UIWebView detect link on textfeild !

    - by Momeks
    Hi i create simple web browser for my app and i don't know why when user click a link the address bar doesn't change as link address here is my code : -(IBAction)webAddress:(id)sender { [site loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[webAdress text]]]]; [webAdress resignFirstResponder]; } - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { //CAPTURE USER LINK-CLICK. if (navigationType == UIWebViewNavigationTypeLinkClicked) { NSURL *URL = [request URL]; if ([[URL scheme] isEqualToString:@"http"]) { [webAdress setText:[URL absoluteString]]; [self webAddress:nil]; } return NO; } return YES; } what's my problem ?

    Read the article

  • Detect Applet context (am I inside an applet?)

    - by 7macaw
    Hi, I'm wondering if there's a way for a Java class to figure out if it is being used within an applet? That is, I have a library (a .jar file) that can be used by 3rd-party applications and applets. It does work within applets, but I'd like to do some things differently, depending on whether or not the library is used in an applet - like show applet-applicable errors, avoid local file I/O, etc. It would be nice if, say, Applet.getAppletContext() was static so that I could call it (and get NULL or not NULL) even if I don't have an applet instance, but alas, it isn't. Is there any other way?

    Read the article

  • Not able to detect a href component in Selenium RC

    - by Anjali
    I have the following link 'Test' in selenium RC script. Analysis When I tried Selenium IDE it gives me following code. The same code does not work with RC . Please help me out with this selenium.click("link=Test"); // code generated with Selenium IDE and same does not work with RC

    Read the article

  • detect div content changes with jquery

    - by Elzo Valugi
    change() function works and detects changes on form elements, but can I have a way of detecting when a html content was changed? This is not working, unless #content is an input fields $("#content").change( function(){ // do something }); I want this to trigger when doing something like: $("#content").html('something'); Also html() or append() function don't have a callback. Any suggestions?

    Read the article

  • Advance way of using UIView convertRect method to detect CGRectIntersectsRect multiple times

    - by Chris
    I recently asked a question regarding collision detection within subviews, with a perfect answer. I've come to the last point in implementing the collision on my application but I've come across a new issue. Using convertRect was fine getting the CGRect from the subView. I needed it to be a little more complex as it wasn't exactly rectangles that needed to be detected. on XCode I created an abstract class called TileViewController. Amongst other properties it has a IBOutlet UIView *detectionView; I now have multiple classes that inherit from TileViewController, and each class there are multiple views nested inside the detectionView which I have created using Interface Builder. The idea is an object could be a certain shape or size, I've programatically placed these 'tiled' detection points bottom center of each object. A user can select an item and interactive with it, in this circumstance move it around. Here is my touchesMoved method -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [[event allTouches] anyObject]; CGPoint location = [touch locationInView:touch.view]; interactiveItem.center = location; // The ViewController the user has chosen to interact with interactiveView.view.center = location; // checks if the user has selected an item to interact with if (interactiveItem) { // First get check there is more then 1 item in the collection NSUInteger assetCount = [itemViewCollection count]; //NSMutableArray that holds the ViewControllers int detectionCount = 0; // To count how many times a CGRectIntersectsRect occured UIView *parentView = self.view; // if there is more then 1 item begin collision detection if (assetCount > 1) { for (TileViewController *viewController in itemViewCollection) { if (viewController.view.tag != interactiveView.view.tag) { if (viewController.detectionView.subviews) { for (UIView *detectView in viewController.detectionView.subviews) { CGRect viewRect; viewRect = [detectView convertRect:[detectView frame] toView:parentView]; // I could have checked to see if the below has subViews but didn't - In my current implementation it does anyway for (UIView *detectInteractView in interactiveView.detectionView.subviews) { CGRect interactRect; interactRect = [detectInteractView convertRect:[detectInteractView frame] toView:parentView]; if (CGRectIntersectsRect(viewRect, interactRect) == 1) { NSLog(@"collision detected"); [detectView setBackgroundColor:[UIColor blueColor]]; [detectInteractView setBackgroundColor:[UIColor blueColor]]; detectionCount++; } else { [detectView setBackgroundColor:[UIColor yellowColor]]; [detectInteractView setBackgroundColor:[UIColor yellowColor]]; } } } } } } // Logic if no items collided if (detectionCount == 0) { NSLog(@"Do something"); } } } } Now the method itself works to an extent but I don't think it's working with the nested values properly as the detection is off. A simplified version of this method works - Using CGRectIntersectsRect on the detectionView itself so I'm wondering if I'm looping through and checking the views correctly? I wasn't sure whether it was comparing in the same view but I suspect it is, I did modify the code slightly at one point, rather then comparing the values in self.view I took the viewController.detectView's UIViews into the interactiveView.detectView but the outcome was the same. It's rigged so the subviews change colour, but they change colour when they are not even touching, and when they do touch the wrong UIviews are changing colour Many thanks in advance

    Read the article

  • How to detect running on WebSphere

    - by Pedro Guedes
    Hi, I'm building a webapp that should run on both Tomcat and WebSphere and I've managed to make almost all the differences into properties with default values that I can override for deployment on the Tomcat server. I need to do yet another override for the authentication provider bean... public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { if(isWebSphere()){ LOG.warn("Running on WebSphere... not overriding default authentication mechanism."); return; } LOG.info("Running on Tomcat... overriding authentication provider bean ("+AUTHENTICATION_PROVIDER_BEAN+")"); if (beanFactory.containsBean(AUTHENTICATOR_BEAN) && beanFactory.containsBean(POPULATOR_BEAN) && beanFactory.containsBean(USERDETAIL_PROVIDER_BEAN)){ LdapAuthenticator authenticator = (LdapAuthenticator) beanFactory.getBean(AUTHENTICATOR_BEAN); LdapAuthoritiesPopulator populator = (LdapAuthoritiesPopulator) beanFactory.getBean(POPULATOR_BEAN); UserDetailProvider userDetailProvider = (UserDetailProvider) beanFactory.getBean(USERDETAIL_PROVIDER_BEAN); ExtendedLdapAuthenticationProvider override = new ExtendedLdapAuthenticationProvider(authenticator, populator); override.setUserDetailProvider(userDetailProvider); beanFactory.registerSingleton(AUTHENTICATION_PROVIDER_BEAN, override); } else { throw new BeanCreationException("Could not find required beans to assemble overriding object for authentication..."); } } Now my problem is how to implement the isWebSphere() method. I was thinking Class.forName("someWebSphereSpecific"), but is there a better way?

    Read the article

  • Detect file creation date on iPhone OS?

    - by Greg Maletic
    I was planning on writing some code whose logic was based upon testing the creation date of a particular file in my app's Documents folder. Turns out, when I call -[NSFileManager attributesOfItemAtPath:error:], NSFileCreationDate isn't one of the provided attributes. Is there no way to discover a file's creation date? Thanks.

    Read the article

  • Using Javascript to detect when a user has selected an item in an ASP.NET listbox

    - by Amr Bekhit
    Hello all, I am developing an ASP.NET web application that incorporates google maps. I have an ASP.NET listbox on my page which contains a list of items. When the user selects one of the items, I'd like to show this item on the map. The main complication lies in the fact that google maps uses javascript to control it and the listbox is a server control. I can think of two ways to do this. The first would involve the listbox calling a javascript function when the user selects a new item. I can then write this function to perform the necessary map operations. Unfortunately, the OnSelectedIndexChanged property of the listbox doesn't seem to support javascript functions. The second involves wrapping an UpdatePanel around the listbox and getting the listbox to perform a postback. In the SelectedIndexChanged event in VB/C#, I would the need to somehow make a call to a javascript function which would then update the map. Which solution can I use? Thanks --Amr

    Read the article

  • How do I detect a connection break using MessageQueue

    - by Lopper
    My application written in C# makes use of the MessageQueue class in .NET for communicating messages with another remote application and the MessageQueue should always be "connected" (heartbeat present) with the remote messageQueue under all circumstances. If it is not "connected", then it signals that something is wrong and my application will need to perform some actions such as updating an event log. Is there a method in the MessageQueue class that can be used to detecting such breaks in connection?

    Read the article

  • SDL doesn't detect Arrow Keys

    - by Scott
    I am working through the SDL tutorials over at http://lazyfoo.net/SDL_tutorials/index.php and I'm stuck on tutorial 8 where I'm working with key presses. I'm using the following code: //Our Main application loop while(!quit){ if(SDL_PollEvent(&curEvents)){ if(curEvents.type == SDL_QUIT){ quit = true; } //If a key was pressed if( curEvents.type == SDL_KEYDOWN ) { //Set the proper message surface switch( curEvents.key.keysym.sym ) { case SDLK_UP: message = upMessage; break; case SDLK_DOWN: message = downMessage; break; case SDLK_LEFT: message = leftMessage; break; case SDLK_RIGHT: message = rightMessage; break; default: message = TTF_RenderText_Solid(font, "Unknown Key", textColor); break; } } } if( message != NULL ) { //Apply the background to the screen applySurface( 0, 0, background, screen ); //Apply the message centered on the screen applySurface( ( SCREEN_WIDTH - message->w ) / 2, ( SCREEN_HEIGHT - message->h ) / 2, message, screen ); //Null the surface pointer message = NULL; } //Update the screen if( SDL_Flip( screen ) == -1 ) { return 1; } } Where works fine, the default case is reached, for everything BUT pressing the arrow keys. I was wondering if someone could spot what I'm doing wrong.

    Read the article

  • Android: How to detect end of scroll

    - by Mix
    Hi! I need to implement HorizontalScrollView which is scrolled to predefined positions (similar to Home behaviour). It works with slow gestures, but does not work with flings. I hooked to View.onScrollChanged() and it is called when scrolling happened, but I can't determine when scrolling ends. In theory there should be a way to say that fling is over. Is there such API?

    Read the article

  • detect face from image and crop face from that photo

    - by Siddhpura Amit
    I have done coding in that i am successfully getting face with rectangle drawing now i want to crop that rectangle area. if there are many rectangle( mean many faces) than user can select one of the face or rectangle and that rectangle areal should be cropped can any body help me... Below is my code class AndroidFaceDetector extends Activity { public String path; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = this.getIntent().getExtras(); path = bundle.getString("mypath"); setContentView(new myView(this)); } class myView extends View { private int imageWidth, imageHeight; private int numberOfFace = 5; private FaceDetector myFaceDetect; private FaceDetector.Face[] myFace; float myEyesDistance; int numberOfFaceDetected; Bitmap myBitmap; public myView(Context context) { super(context); System.out.println("CONSTRUCTOR"); System.out.println("path = "+path); if (path != null) { BitmapFactory.Options BitmapFactoryOptionsbfo = new BitmapFactory.Options(); BitmapFactoryOptionsbfo.inPreferredConfig = Bitmap.Config.RGB_565; myBitmap = BitmapFactory.decodeFile(path, BitmapFactoryOptionsbfo); imageWidth = myBitmap.getWidth(); imageHeight = myBitmap.getHeight(); myFace = new FaceDetector.Face[numberOfFace]; myFaceDetect = new FaceDetector(imageWidth, imageHeight, numberOfFace); numberOfFaceDetected = myFaceDetect.findFaces(myBitmap, myFace); } else { Toast.makeText(AndroidFaceDetector.this, "Please Try again", Toast.LENGTH_SHORT).show(); } } @Override protected void onDraw(Canvas canvas) { System.out.println("ON DRAW IS CALLED"); if (myBitmap != null) { canvas.drawBitmap(myBitmap, 0, 0, null); Paint myPaint = new Paint(); myPaint.setColor(Color.GREEN); myPaint.setStyle(Paint.Style.STROKE); myPaint.setStrokeWidth(3); for (int i = 0; i < numberOfFaceDetected; i++) { Face face = myFace[i]; PointF myMidPoint = new PointF(); face.getMidPoint(myMidPoint); myEyesDistance = face.eyesDistance(); canvas.drawRect((int) (myMidPoint.x - myEyesDistance), (int) (myMidPoint.y - myEyesDistance), (int) (myMidPoint.x + myEyesDistance), (int) (myMidPoint.y + myEyesDistance), myPaint); } } } } }

    Read the article

  • Detect click on URL in RichEdit

    - by Tofig Hasanov
    I am trying to update RichEdit so that it detects URL and enables clicking on it to open in the browser. Detecting URL is easy, I just use the following code from http://www.scalabium.com/faq/dct0146.htm mask := SendMessage(MNote.Handle, EM_GETEVENTMASK, 0, 0); SendMessage(MNote.Handle, EM_SETEVENTMASK, 0, mask or ENM_LINK); SendMessage(MNote.Handle, EM_AUTOURLDETECT, Integer(True), 0); but the second part doesn't work for me. They give the following code to capture EN_LINK message and processing it: type TForm1 = class(TForm) protected procedure WndProc(var Message: TMessage); override; end; ... procedure TForm1.WndProc(var Message: TMessage); var p: TENLink; strURL: string; begin if (Message.Msg = WM_NOTIFY) then begin if (PNMHDR(Message.LParam).code = EN_LINK) then begin p := TENLink(Pointer(TWMNotify(Message).NMHdr)^); if (p.msg = WM_LBUTTONDOWN) then begin SendMessage(RichEdit1.Handle, EM_EXSETSEL, 0, LongInt(@(p.chrg))); strURL := RichEdit1.SelText; ShellExecute(Handle, 'open', PChar(strURL), 0, 0, SW_SHOWNORMAL); end end end; inherited; end; When I run the program, URL is detected, but clicking on it doesn't do anything. Using debug I found out that Message.Msg = WM_NOTIFY is not true when I click on URL. I then tried to override TRichEdit's WndProc, but result is the same. Any suggestions?

    Read the article

  • Configuring hibernate.reveng.xml to detect a sequence PK generator with hibernate3-maven-plugin and

    - by mmm
    Hi, is there a way to configure hibernate3-maven-plugin so that a sequence generator is detected for a primary-key? I'm using a bottom-up approach for hibernate configuration (which means letting hibernate-tools generate the hibernate configuration using a jdbc-connection for you via reverse-engineering on an existing database schema). I've read this, but also this already (those two can be unrelated, but can also leave a hint). My hibernate.reveng.xml is the following: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" > <hibernate-reverse-engineering> <table name="ORDERS"> <primary-key> <!-- setting up a specific id generator for a table --> <generator class="sequence"> <param name="sequence">ORDERS_ORDER_ID_seq</param> </generator> <key-column name="ORDER_ID"/> </primary-key> </table> </hibernate-reverse-engineering> And I'm expecting it to generate an Orders.hbm.xml file like this: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated 2010-06-06 18:55:42 by Hibernate Tools 3.2.2.GA --> <hibernate-mapping> <class name="some.package.Orders" table="orders" schema="public"> <id name="orderId" type="long"> <column name="order_id" /> <generator class="sequence"> <param name="sequence">ORDERS_ORDER_ID_seq</param> </generator> </id> ... </class> </hibernate-mapping> ...but receiving this instead: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated 2010-06-06 18:55:42 by Hibernate Tools 3.2.2.GA --> <hibernate-mapping> <class name="some.package.Orders" table="orders" schema="public"> <id name="orderId" type="long"> <column name="order_id" /> <generator class="assigned" /> </id> ... </class> </hibernate-mapping> I know my hibernate.reveng.xml is being read by hibernate3-maven-plugin, as I experience maven errors whenever syntax errors appear in the file, so pom.xml seems to be correct and hibernate.reveng.xml syntactically correct. Any clues?

    Read the article

< Previous Page | 124 125 126 127 128 129 130 131 132 133 134 135  | Next Page >