Search Results

Search found 440 results on 18 pages for 'abs'.

Page 3/18 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • An efficient setup of several VPSs on one box?

    - by Abs
    Hello all, I hope its ok to ask this question on serverfault, its not an actual fault but more of an implementation advice request. I would like to have a dedicated server that I can deploy my own VPSs on. These VPS will be various windows, Mac and Linux operating systems. I was thinking of buying a large Linux based dedicated server and then running VMWare Server or Virtualbox and adding my own images on there for each OS but I am thinking this isn't going to be cost effective and easy to maintain. I am hoping someone can help me with the perfect setup that is both cost effective and efficient so that I can have 6 VPS at my disposal that I can easily control. Thanks all for any help.

    Read the article

  • How can I parse/ transform text log data before it gets captured in SCOM 2007 R2?

    - by Abs
    I'm pretty much a noob with System Center Operations Manager 2007, and I'm probably missing something pretty basic, but I'm stumped anyway. We're setting up monitoring on some of our servers, and we'd like to capture data from some plain text log files (e.g. DNS debug logs, DHCP logs). It looks to me like I can set up a generic text file monitoring rule and get events captured into the main Ops Manager database, but my understanding is that the whole line of text from the plain text log gets captured as one field. In an ideal world, we'd be able to parse or transform that log file data to make it easier to query later. Is this possible? Is it easy? Do I have to buy expensive 3rd-party software to do it? One more thing: it would be even better if there was a way to stuff this data into the Audit Collection Services (ACS) database instead of the main one, but I'll take what I can get. Any help would be greatly appreciated.

    Read the article

  • 404 Not Found for a PL script that exists!

    - by Abs
    Hello all, I make a GET request to a CGI script and I get a 404 error. However, I am 100% sure that script is present and it has permissions: -rwxr-xr-x 1 apache apache 6520 Sep 7 03:01 uu_ini_status_audios.pl The request URL is: http://mysite.com/cgi-bin/uu_ini_status_audios.pl?tmp_sid=893facacc5dc392ad0f4c91e6a9e8d40&rnd_id=0.12266222834382812 The error I get: The requested URL /cgi-bin/uu_ini_status_audios.pl was not found on this server. This use to work for me before, but I think it stopped working after I restarted apache so maybe it means its a configuration I changed?? I checked the error logs for apache and php and nothing useful was found to help me with my problem! I appreciate any help on this!

    Read the article

  • 404 Error on a file that exists?

    - by Abs
    Hello all, A script makes a GET request to my URL like so: http://mydomain.com/cgi-bin/uu_ini_status_audios.pl?tmp_sid=b742be1d131c4d32237a9f1fcdca659e&rnd_id=0.2363453360320319 However, I get a 404 returned straight away: The requested URL /cgi-bin/uu_ini_status_audios.pl was not found on this server. But that script exists on my server, I can see the file! It has the correct permissions (I gave it a 777 to be sure). It is also owned by my apache user and its in the group apache. What am I missing?? Thanks for any help on this! Update I thought it would have been a htaccess (rewrite) but I don't think it is anymore. I tried putting a index.php file in there and try to access it via my URL but I can't even do that! I tried this: http://mydoamin.com/cgi-bin/index.php - same 404 error! I get this in myerror log: [Tue Sep 14 14:42:49 2010] [error] [client xx.xxx.xx.xxx] script not found or unable to stat: /var/www/vhosts/mydomain.com/cgi-bin Access_log file: xx.xxx.xx.xxx - - [14/Sep/2010:14:48:25 +0200] "GET /cgi-bin/index.php HTTP/1.1" 404 475 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9 (.NET CLR 3.5.30729)" Update 2 My htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^blog/ - [L] RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC] RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L] RewriteRule ^search/(.*)/(.*)/(.*)/(.*) /search.php?searchfor=$1&sortby=$2&page=$3&searchterm=$4 RewriteRule ^confirmemail/(.*) /confirmemail.php?code=$1 RewriteRule ^resetpassword/(.*) /resetpassword.php?code=$1 RewriteRule ^resendconfirmation/(.*) /resendconfirmation.php?userid=$1 RewriteRule ^categories/ /categories.php RewriteRule ^([-_~*a-zA-Z0-9]+)(\/)?$ /memberprofile.php?username=$1 RewriteRule ^browse/audios/(.*)/(.*)/(.*)/(.*) /audios.php?sortby=$1&filter=$2&page=$3&title=$4 RewriteRule ^browse/categories/audios/(.*)/(.*)/(.*)/(.*) /categoryaudios.php?sortby=$1&filter=$2&page=$3&title=$4 RewriteRule ^audios/(.*)/(.*) /playaudio.php?audioid=$1&title=$2 RewriteRule ^download/audio/(.*)/(.*) /downloadaudio.php?AUDIOID=$1&title=$2 RewriteRule ^members/audios/(.*)/(.*) /memberaudios.php?pid=$1&username=$2 RewriteRule ^syndicate/audios/(.*)/(.*) /syndicateaudios.php?filter=$1&title=$2 </IfModule> Update 3 [root@smydomain ~]# ls -la /var/www/vhosts/mydoamin.com/httpdocs/cgi-bin/ total 60 drwxr-xr-x 3 apache root 4096 Sep 14 14:37 . drwxr-x--- 20 som psaserv 4096 Sep 14 14:40 .. drwxr-xr-x 2 apache root 4096 Sep 7 03:01 configs -rwxrwxrwx 1 apache root 4 Sep 14 14:37 index.php -rwxrwxrwx 1 apache apache 6520 Sep 7 03:01 uu_ini_status_audios.pl -rwxr-xr-x 1 apache root 3215 Sep 7 03:01 uu_lib_audios.pl -rwxr-xr-x 1 apache root 30249 Sep 7 03:01 uu_upload_audios.pl

    Read the article

  • Clearing cmd.exe memory or cache

    - by Abs
    The main question is how do I clear the command prompts memory or cache. I ran this on cmd.exe svn info <URL> Which prompted me a for a username and password which I entered. I then logged off and logged back in immediately and I entered that same command and I wasn't asked for a username and password. I want to clear this to test something without restarting my server! How can I do this?

    Read the article

  • Using AWS SES with Sendmail

    - by Abs
    I am trying to send mail via AWS SES uisng Sendmail. I have Sendmail version 8.14.4 installed and I followed the first section of this useful tutorial by Amazon. However, I get this: root@:/etc/mail# echo "Subject: test" | sendmail -v [email protected] [email protected]... Connecting to [127.0.0.1] via relay... [email protected]... Deferred: Connection timed out with [127.0.0.1] Can anyone help me get this working? The logs have the following: Dec 14 10:35:21 ip-10-xx-xx-181 sm-msp-queue[17910]: qBE8K1Lu016411: to=root, delay=00:21:24, xdelay=00:06:19, mailer=relay, pri=121806, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection timed out with [127.0.0.1]

    Read the article

  • Additional Hard Drives for Servers

    - by Abs
    Hello all, I am developing a web app where I will have to save lots of files and I am just trying to work out the directory structure and where things should be saved to. I have had a look at the dedicated server I want to buy and for storage it shows this: 2x 1TB SATA in RAID1 The space is enough but I am guessing this will not be on one hard drive? I will have to save files on one hard drive and when that fills up, I have to use the other? For the Fedora distro - what is the path for the second drive? Is there a primary drive where I will be able to setup my webroot? I am sorry, this is all new to me. It would be great to links and advice on how things actually work when it comes to additional hard drives etc. Thanks all

    Read the article

  • How do I reduce RAM usage on my server?

    - by Abs
    I have recently launched a site that is very popular but I am having trouble with scalability. My site makes heavy use of FFmpeg and at peak times RAM usage hits the 2 GB point quickly and the swap file starts getting used. CPU usage starts rising too. Users complain that the site is slow. They say this because all FFmpeg instances run very slow because of the number running at the same time. Users make use of FFmpeg on my server in real time. Is there anything I can consider or do to ease down the usage of the server and RAM just shooting up? Maybe there is something better than FFmpeg (!). Is the only solution "throwing some cash" at a more powerful server? I have given little information, please ask for more, so this problem can be solved.

    Read the article

  • What does the float number indicate when using varnishtop?

    - by Abs
    I have Varnish running and I wanted to see what http response codes commonly occur. I used: varnishtop -i TxStatus However, I am struggling to work out what the numbers on the right mean? Is it number of requests? list length 7 1322.16 TxStatus 200 60.43 TxStatus 302 8.67 TxStatus 304 3.14 TxStatus 500 2.96 TxStatus 404 0.80 TxStatus 301 0.56 TxStatus 403

    Read the article

  • current location too slow for view

    - by Christian
    Hi, I make an App with a Map in the App and a button to change to the google.Map-App. The code for my position is: -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { float avgAccuracy = (newLocation.verticalAccuracy + newLocation.horizontalAccuracy)/2.0; if (avgAccuracy < 500) { [locationManager stopUpdatingLocation]; locationManager.delegate = nil; } storedLocation = [newLocation coordinate]; The code for the view is: - (void)viewDidLoad { [super viewDidLoad]; UIImage *image = [UIImage imageNamed: @"LogoNavBar.png"]; UIImageView *imageview = [[UIImageView alloc] initWithImage: image]; UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView: imageview]; self.navigationItem.rightBarButtonItem = button; [imageview release]; [button release]; locationManager=[[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.distanceFilter = kCLDistanceFilterNone; [locationManager startUpdatingLocation]; mapView.showsUserLocation = YES; NSLog(@"storedLocation-latitude für MKregion: %f", storedLocation.latitude); MKCoordinateRegion region; region.center.latitude = (storedLocation.latitude + 45.58058)/2.0; region.center.longitude = (storedLocation.longitude - 0.546835)/2.0; region.span.latitudeDelta = ABS(storedLocation.latitude - 45.58058); region.span.longitudeDelta = ABS(storedLocation.longitude + 0.546835); [mapView setRegion:region animated:TRUE]; MKCoordinateRegion hotel; hotel.center.latitude = 45.58058; hotel.center.longitude = -0.546835; HotelPositionMarker* marker = [[HotelPositionMarker alloc] initWithCoordinate:hotel.center]; [mapView addAnnotation:marker]; [marker release]; } My problem: when the "viewDidLoad" start, the "storedLocation" is still 0.0000 it takes a bit longer to get the own position than to start the view. The Log for the "storedLocation" in the "viewDidLoad"-section is 0 while the Log of the "storedLocation" in the "-(IBAction)" when the map is visible contains the right values. How can I manage it to have my coordinates before the view load? I need them to center the view concerning the own position and the position given by me. MKCoordinateRegion region; region.center.latitude = (storedLocation.latitude + 45.58058)/2.0; region.center.longitude = (storedLocation.longitude - 0.546835)/2.0; region.span.latitudeDelta = ABS(storedLocation.latitude - 45.58058); region.span.longitudeDelta = ABS(storedLocation.longitude + 0.546835); [mapView setRegion:region animated:TRUE];

    Read the article

  • SQL - How to join on similar (not exact) columns

    - by BlueRaja
    I have two tables which get updated at almost the exact same time - I need to join on the datetime column. I've tried this: SELECT * FROM A, B WHERE ABS(DATEDIFF(second, A.Date_Time, B.Date_Time) = ( SELECT MIN(ABS(DATEDIFF(second, A.Date_Time, B2.Date_Time))) FROM B AS B2 ) But it tells me: Multiple columns are specified in an aggregated expression containing an outer reference. If an expression being aggregated contains an outer reference, then that outer reference must be the only column referenced in the expression. How can I join these tables?

    Read the article

  • android actionbarsherlok demo codes

    - by Guillermo Varini
    I have being using this actionbarsherlok to give some nice style to my app. My doubt is that i can test ABS: fragment code, but i want to check out ABS: Demos code. Is it possible? i cant find it on .zip or web page, just the .apk em i missing something? in case we can not look that code, is there a good repository where they teach the way to implement the new tabs that android want us to use (3.0+++)?

    Read the article

  • using regular expression in Java

    - by Mrityunjay
    Hi, i need to check a string that should contain only ABCDEFG characters, in any sequence and with only 7 characters. Please let me know the correct way of using regular expression. as corrently i am using String abs = "ABPID"; if(!Pattern.matches("[[ABCDEFG]", abs)) System.out.println("Error"); i am using the following code which works when i use the String abcdefg but for other cases it fails. please help me out.

    Read the article

  • Matlab code works with one version but not the other

    - by user1325655
    I have a code that works in Matlab version R2010a but shows errors in matlab R2008a. I am trying to implement a self organizing fuzzy neural network with extended kalman filter. I have the code running but it only works in matlab version R2010a. It doesn't work with other versions. Any help? Code attach function [ c, sigma , W_output ] = SOFNN( X, d, Kd ) %SOFNN Self-Organizing Fuzzy Neural Networks %Input Parameters % X(r,n) - rth traning data from nth observation % d(n) - the desired output of the network (must be a row vector) % Kd(r) - predefined distance threshold for the rth input %Output Parameters % c(IndexInputVariable,IndexNeuron) % sigma(IndexInputVariable,IndexNeuron) % W_output is a vector %Setting up Parameters for SOFNN SigmaZero=4; delta=0.12; threshold=0.1354; k_sigma=1.12; %For more accurate results uncomment the following %format long; %Implementation of a SOFNN model [size_R,size_N]=size(X); %size_R - the number of input variables c=[]; sigma=[]; W_output=[]; u=0; % the number of neurons in the structure Q=[]; O=[]; Psi=[]; for n=1:size_N x=X(:,n); if u==0 % No neuron in the structure? c=x; sigma=SigmaZero*ones(size_R,1); u=1; Psi=GetMePsi(X,c,sigma); [Q,O] = UpdateStructure(X,Psi,d); pT_n=GetMeGreatPsi(x,Psi(n,:))'; else [Q,O,pT_n] = UpdateStructureRecursively(X,Psi,Q,O,d,n); end; KeepSpinning=true; while KeepSpinning %Calculate the error and if-part criteria ae=abs(d(n)-pT_n*O); %approximation error [phi,~]=GetMePhi(x,c,sigma); [maxphi,maxindex]=max(phi); % maxindex refers to the neuron's index if ae>delta if maxphi<threshold %enlarge width [minsigma,minindex]=min(sigma(:,maxindex)); sigma(minindex,maxindex)=k_sigma*minsigma; Psi=GetMePsi(X,c,sigma); [Q,O] = UpdateStructure(X,Psi,d); pT_n=GetMeGreatPsi(x,Psi(n,:))'; else %Add a new neuron and update structure ctemp=[]; sigmatemp=[]; dist=0; for r=1:size_R dist=abs(x(r)-c(r,1)); distIndex=1; for j=2:u if abs(x(r)-c(r,j))<dist distIndex=j; dist=abs(x(r)-c(r,j)); end; end; if dist<=Kd(r) ctemp=[ctemp; c(r,distIndex)]; sigmatemp=[sigmatemp ; sigma(r,distIndex)]; else ctemp=[ctemp; x(r)]; sigmatemp=[sigmatemp ; dist]; end; end; c=[c ctemp]; sigma=[sigma sigmatemp]; Psi=GetMePsi(X,c,sigma); [Q,O] = UpdateStructure(X,Psi,d); KeepSpinning=false; u=u+1; end; else if maxphi<threshold %enlarge width [minsigma,minindex]=min(sigma(:,maxindex)); sigma(minindex,maxindex)=k_sigma*minsigma; Psi=GetMePsi(X,c,sigma); [Q,O] = UpdateStructure(X,Psi,d); pT_n=GetMeGreatPsi(x,Psi(n,:))'; else %Do nothing and exit the while KeepSpinning=false; end; end; end; end; W_output=O; end function [Q_next, O_next,pT_n] = UpdateStructureRecursively(X,Psi,Q,O,d,n) %O=O(t-1) O_next=O(t) p_n=GetMeGreatPsi(X(:,n),Psi(n,:)); pT_n=p_n'; ee=abs(d(n)-pT_n*O); %|e(t)| temp=1+pT_n*Q*p_n; ae=abs(ee/temp); if ee>=ae L=Q*p_n*(temp)^(-1); Q_next=(eye(length(Q))-L*pT_n)*Q; O_next=O + L*ee; else Q_next=eye(length(Q))*Q; O_next=O; end; end function [ Q , O ] = UpdateStructure(X,Psi,d) GreatPsiBig = GetMeGreatPsi(X,Psi); %M=u*(r+1) %n - the number of observations [M,~]=size(GreatPsiBig); %Others Ways of getting Q=[P^T(t)*P(t)]^-1 %************************************************************************** %opts.SYM = true; %Q = linsolve(GreatPsiBig*GreatPsiBig',eye(M),opts); % %Q = inv(GreatPsiBig*GreatPsiBig'); %Q = pinv(GreatPsiBig*GreatPsiBig'); %************************************************************************** Y=GreatPsiBig\eye(M); Q=GreatPsiBig'\Y; O=Q*GreatPsiBig*d'; end %This function works too with x % (X=X and Psi is a Matrix) - Gets you the whole GreatPsi % (X=x and Psi is the row related to x) - Gets you just the column related with the observation function [GreatPsi] = GetMeGreatPsi(X,Psi) %Psi - In a row you go through the neurons and in a column you go through number of %observations **** Psi(#obs,IndexNeuron) **** GreatPsi=[]; [N,U]=size(Psi); for n=1:N x=X(:,n); GreatPsiCol=[]; for u=1:U GreatPsiCol=[ GreatPsiCol ; Psi(n,u)*[1; x] ]; end; GreatPsi=[GreatPsi GreatPsiCol]; end; end function [phi, SumPhi]=GetMePhi(x,c,sigma) [r,u]=size(c); %u - the number of neurons in the structure %r - the number of input variables phi=[]; SumPhi=0; for j=1:u % moving through the neurons S=0; for i=1:r % moving through the input variables S = S + ((x(i) - c(i,j))^2) / (2*sigma(i,j)^2); end; phi = [phi exp(-S)]; SumPhi = SumPhi + phi(j); %phi(u)=exp(-S) end; end %This function works too with x, it will give you the row related to x function [Psi] = GetMePsi(X,c,sigma) [~,u]=size(c); [~,size_N]=size(X); %u - the number of neurons in the structure %size_N - the number of observations Psi=[]; for n=1:size_N [phi, SumPhi]=GetMePhi(X(:,n),c,sigma); PsiTemp=[]; for j=1:u %PsiTemp is a row vector ex: [1 2 3] PsiTemp(j)=phi(j)/SumPhi; end; Psi=[Psi; PsiTemp]; %Psi - In a row you go through the neurons and in a column you go through number of %observations **** Psi(#obs,IndexNeuron) **** end; end

    Read the article

  • Ordering sql query results

    - by user343409
    My sql query gives the columns: product_id (which is an integer) pnl (which is float - can be negative) I get more than 100 rows. I want to filter out the top 40 rows based on abs(pnl). But the results should be ordered by pnl column only and not by abs(pnl). I want to do this for MSSQL 2005. Is there a way to do this?

    Read the article

  • AABB vs OBB Collision Resolution jitter on corners

    - by patt4179
    I've implemented a collision library for a character who is an AABB and am resolving collisions between AABB vs AABB and AABB vs OBB. I wanted slopes for certain sections, so I've toyed around with using several OBBs to make one, and it's working great except for one glaring issue; The collision resolution on the corner of an OBB makes the player's AABB jitter up and down constantly. I've tried a few things I've thought of, but I just can't wrap my head around what's going on exactly. Here's a video of what's happening as well as my code: Here's the function to get the collision resolution (I'm likely not doing this the right way, so this may be where the issue lies): public Vector2 GetCollisionResolveAmount(RectangleCollisionObject resolvedObject, OrientedRectangleCollisionObject b) { Vector2 overlap = Vector2.Zero; LineSegment edge = GetOrientedRectangleEdge(b, 0); if (!SeparatingAxisForRectangle(edge, resolvedObject)) { LineSegment rEdgeA = new LineSegment(), rEdgeB = new LineSegment(); Range axisRange = new Range(), rEdgeARange = new Range(), rEdgeBRange = new Range(), rProjection = new Range(); Vector2 n = edge.PointA - edge.PointB; rEdgeA.PointA = RectangleCorner(resolvedObject, 0); rEdgeA.PointB = RectangleCorner(resolvedObject, 1); rEdgeB.PointA = RectangleCorner(resolvedObject, 2); rEdgeB.PointB = RectangleCorner(resolvedObject, 3); rEdgeARange = ProjectLineSegment(rEdgeA, n); rEdgeBRange = ProjectLineSegment(rEdgeB, n); rProjection = GetRangeHull(rEdgeARange, rEdgeBRange); axisRange = ProjectLineSegment(edge, n); float axisMid = (axisRange.Maximum + axisRange.Minimum) / 2; float projectionMid = (rProjection.Maximum + rProjection.Minimum) / 2; if (projectionMid > axisMid) { overlap.X = axisRange.Maximum - rProjection.Minimum; } else { overlap.X = rProjection.Maximum - axisRange.Minimum; overlap.X = -overlap.X; } } edge = GetOrientedRectangleEdge(b, 1); if (!SeparatingAxisForRectangle(edge, resolvedObject)) { LineSegment rEdgeA = new LineSegment(), rEdgeB = new LineSegment(); Range axisRange = new Range(), rEdgeARange = new Range(), rEdgeBRange = new Range(), rProjection = new Range(); Vector2 n = edge.PointA - edge.PointB; rEdgeA.PointA = RectangleCorner(resolvedObject, 0); rEdgeA.PointB = RectangleCorner(resolvedObject, 1); rEdgeB.PointA = RectangleCorner(resolvedObject, 2); rEdgeB.PointB = RectangleCorner(resolvedObject, 3); rEdgeARange = ProjectLineSegment(rEdgeA, n); rEdgeBRange = ProjectLineSegment(rEdgeB, n); rProjection = GetRangeHull(rEdgeARange, rEdgeBRange); axisRange = ProjectLineSegment(edge, n); float axisMid = (axisRange.Maximum + axisRange.Minimum) / 2; float projectionMid = (rProjection.Maximum + rProjection.Minimum) / 2; if (projectionMid > axisMid) { overlap.Y = axisRange.Maximum - rProjection.Minimum; overlap.Y = -overlap.Y; } else { overlap.Y = rProjection.Maximum - axisRange.Minimum; } } return overlap; } And here is what I'm doing to resolve it right now: if (collisionDetection.OrientedRectangleAndRectangleCollide(obb, player.PlayerCollision)) { var resolveAmount = collisionDetection.GetCollisionResolveAmount(player.PlayerCollision, obb); if (Math.Abs(resolveAmount.Y) < Math.Abs(resolveAmount.X)) { var roundedAmount = (float)Math.Floor(resolveAmount.Y); player.PlayerCollision._position.Y -= roundedAmount; } else if (Math.Abs(resolveAmount.Y) <= 30.0f) //Catch cases where the player should be able to step over the top of something { var roundedAmount = (float)Math.Floor(resolveAmount.Y); player.PlayerCollision._position.Y -= roundedAmount; } else { var roundedAmount = (float)Math.Floor(resolveAmount.X); player.PlayerCollision._position.X -= roundedAmount; } } Can anyone see what might be the issue here, or has anyone experienced this before that knows a possible solution? I've tried for a few days to figure this out on my own, but I'm just stumped.

    Read the article

  • Listview Swipe inside viewflipper

    - by Faisal Abid
    Im trying to swipe left and right on a listview and get the viewflipper to swtich. Just like the remeberthemilk app and the default news and weather app on the nexus one (Swiping through news topics). Using various tutorials ive found , i came across on one stackoverflow that shows how to implement a swipe gesture class MyGestureDetector extends SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { try { if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) return true; // right to left swipe if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { viewFlipper.setInAnimation(slideRightIn); viewFlipper.setOutAnimation(slideRightOut); viewFlipper.showPrevious(); } } catch (Exception e) { // nothing } return true; } } And i got this working by doing lstView.setOnTouchListener(gestureListener); However sometimes what would happen is the listview setOnItemClickListener would be fired when the person is swiping. How do i prevent this from happening, and only get the setOnItemClickListener fired when the user actually clicks on it list item and not just swiping on it. Thanks, Faisal Abid

    Read the article

  • car race game collision condition.

    - by ashok patidar
    in this how can rotate car when it goes to collied with the track side. package { import flash.display.MovieClip; import flash.events.Event; import flash.events.KeyboardEvent; import flash.text.TextField; import flash.ui.Keyboard; import Math; /** * ... * @author Ashok */ public class F1race extends MovieClip { public var increment:Number = 0; //amount the car moves each frame public var posNeg:Number = 1; public var acceleration:Number = .05; //acceleration of the car, or the amount increment gets increased by. public var speed:Number = 0; //the speed of the car that will be displayed on screen public var maxSpeed:Number = 100; public var keyLeftPressed:Boolean; public var keyRightPressed:Boolean; public var keyUpPressed:Boolean; public var keyDownPressed:Boolean; public var spedometer:TextField = new TextField(); public var carRotation:Number ; public var txt_hit:TextField = new TextField(); public function F1race() { carRotation = carMC.rotation; trace(carMC.rotation); //addChild(spedometer); //spedometer.x = 0; //spedometer.y = 0; addChild(txt_hit); txt_hit.x = 0; txt_hit.y = 100; //rotation of the car addEventListener(Event.ENTER_FRAME, onEnterFrameFunction); stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed,false); stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased,false); carMC.addEventListener(Event.ENTER_FRAME, carOver_road) } public function carOver_road(event:Event):void { //trace(texture.hitTestPoint(carMC.x,carMC.y,true),"--"); /* if(!texture.hitTestPoint(carMC.x,carMC.y,true)) { txt_hit.text = "WRONG WAY"; if(increment!=0) { increment=1; } } else { txt_hit.text = ""; //increment++; }*/ if (roadless.hitTestPoint(carMC.x - carMC.width / 2, carMC.y,true)) { trace("left Hit" + carMC.rotation); //acceleration = .005; //if(carMC.rotation>90 || carMC.rotation>90 //carMC.rotation += 2; if ((carMC.rotation >= 90) && (carMC.rotation <= 180)) { carMC.rotation += 3; carMC.x += 3; } if ((carMC.rotation <= -90) && (carMC.rotation >= -180)) { carMC.rotation += 3; texture.y -= 3; } if ((carMC.rotation > -90) && (carMC.rotation <= -1)) { carMC.rotation += 3; texture.y -= 3; } if(increment<0) { increment += 1.5 * acceleration; } if(increment>0) { increment -= 1.5 * acceleration; } } if (roadless.hitTestPoint(carMC.x + carMC.width / 2, carMC.y,true)) { trace("left right"); //carMC.rotation -= 2; if(increment<0) { increment += 1.5 * acceleration; } if(increment>0) { increment -= 1.5 * acceleration; } } if (roadless.hitTestPoint(carMC.x, carMC.y- carMC.height / 2,true)) { trace("left right"); //carMC.rotation -= 2; if(increment<0) { increment += 1.5 * acceleration; } if(increment>0) { increment -= 1.5 * acceleration; } } if (roadless.hitTestPoint(carMC.x, carMC.y+ carMC.height / 2,true)) { trace("left right"); //carMC.rotation -= 2; if(increment<0) { increment += 1.5 * acceleration; } if(increment>0) { increment -= 1.5 * acceleration; } } if ((!roadless.hitTestPoint(carMC.x - carMC.width / 2, carMC.y, true)) && (!roadless.hitTestPoint(carMC.x, carMC.y- carMC.height / 2,true)) && (!roadless.hitTestPoint(carMC.x, carMC.y+ carMC.height / 2,true)) && (!roadless.hitTestPoint(carMC.x, carMC.y+ carMC.height / 2,true))) { //acceleration = .05; } } public function onEnterFrameFunction(events:Event):void { speed = Math.round((increment) * 5); spedometer.text = String(speed); if ((carMC.rotation < 180)&&(carMC.rotation >= 0)){ carRotation = carMC.rotation; posNeg = 1; } if ((carMC.rotation < 0)&&(carMC.rotation > -180)){ carRotation = -1 * carMC.rotation; posNeg = -1; } if (keyRightPressed) { carMC.rotation += .5 * increment; carMC.LWheel.rotation = 8; carMC.RWheel.rotation = 8; steering.gotoAndStop(2); } if (keyLeftPressed) { carMC.rotation -= .5 * increment; carMC.LWheel.rotation = -8; carMC.RWheel.rotation = -8; steering.gotoAndStop(3); } if (keyDownPressed) { steering.gotoAndStop(1); carMC.LWheel.rotation = 0; carMC.RWheel.rotation = 0; increment -= 0.5 * acceleration; texture.y -= ((90 - carRotation) / 90) * increment; roadless.y = texture.y; if (((carMC.rotation > 90)&&(carMC.rotation < 180))||((carMC.rotation < -90)&&(carMC.rotation > -180))) { texture.x += posNeg * (((((1 - (carRotation / 360)) * 360) - 180) / 90) * increment); roadless.x = texture.x; } if (((carMC.rotation <= 90)&&(carMC.rotation > 0))||((carMC.rotation >= -90)&&(carMC.rotation < -1))) { texture.x += posNeg * ((carRotation) / 90) * increment; roadless.x = texture.x; } increment -= 1 * acceleration; if ((Math.abs(speed)) < (Math.abs(maxSpeed))) { increment += acceleration; } if ((Math.abs(speed)) == (Math.abs(maxSpeed))) { trace("hello"); } } if (keyUpPressed) { steering.gotoAndStop(1); carMC.LWheel.rotation = 0; carMC.RWheel.rotation = 0; //trace(carMC.rotation); texture.y -= ((90 - carRotation) / 90) * increment; roadless.y = texture.y; if (((carMC.rotation > 90)&&(carMC.rotation < 180))||((carMC.rotation < -90)&&(carMC.rotation > -180))) { texture.x += posNeg * (((((1 - (carRotation / 360)) * 360) - 180) / 90) * increment); roadless.x = texture.x; } if (((carMC.rotation <= 90)&&(carMC.rotation > 0))||((carMC.rotation >= -90)&&(carMC.rotation < -1))) { texture.x += posNeg * ((carRotation) / 90) * increment; roadless.x = texture.x; } increment += 1 * acceleration; if ((Math.abs(speed)) < (Math.abs(maxSpeed))) { increment += acceleration; } } if ((!keyUpPressed) && (!keyDownPressed)){ /*if (increment > 0 && (!keyUpPressed)&& (!keyDownPressed)) { //texture.y -= ((90-carRotation)/90)*increment; increment -= 1.5 * acceleration; } if((increment==0)&&(!keyUpPressed)&& (!keyDownPressed)) { increment = 0; } if((increment<0)&&(!keyUpPressed)&& (!keyDownPressed)) { increment += 1.5 * acceleration; }*/ if (increment > 0) { increment -= 1.5 * acceleration; texture.y -= ((90 - carRotation) / 90) * increment; roadless.y = texture.y; if (((carMC.rotation > 90)&&(carMC.rotation < 180))||((carMC.rotation < -90)&&(carMC.rotation > -180))) { texture.x += posNeg * (((((1 - (carRotation / 360)) * 360) - 180) / 90) * increment); roadless.x = texture.x; } if (((carMC.rotation <= 90)&&(carMC.rotation > 0))||((carMC.rotation >= -90)&&(carMC.rotation < -1))) { texture.x += posNeg * ((carRotation) / 90) * increment; roadless.x = texture.x; } } if (increment == 0) { increment = 0; } if (increment < 0) { increment += 1.5 * acceleration; texture.y -= ((90 - carRotation) / 90) * increment; roadless.y = texture.y; if (((carMC.rotation > 90)&&(carMC.rotation < 180))||((carMC.rotation < -90)&&(carMC.rotation > -180))) { texture.x += posNeg * (((((1 - (carRotation / 360)) * 360) - 180) / 90) * increment); roadless.x = texture.x; } if (((carMC.rotation <= 90)&&(carMC.rotation > 0))||((carMC.rotation >= -90)&&(carMC.rotation < -1))) { texture.x += posNeg * ((carRotation) / 90) * increment; roadless.x = texture.x; } } } } public function keyPressed(event:KeyboardEvent):void { trace("keyPressed"); if (event.keyCode == Keyboard.LEFT) { keyLeftPressed = true; } if (event.keyCode == Keyboard.RIGHT) { keyRightPressed = true; } if (event.keyCode == Keyboard.UP) { keyUpPressed = true; } if (event.keyCode == Keyboard.DOWN) { keyDownPressed = true; } } public function keyReleased(event:KeyboardEvent):void { trace("keyReleased..."); //increment -= 1.5 * acceleration; //increment--; if (event.keyCode == Keyboard.LEFT) { keyLeftPressed = false; } if (event.keyCode == Keyboard.RIGHT) { keyRightPressed = false; } if (event.keyCode == Keyboard.UP) { keyUpPressed = false; } if (event.keyCode == Keyboard.DOWN) { keyDownPressed = false; } } } }

    Read the article

  • Groovy as a substitute for Java when using BigDecimal?

    - by geejay
    I have just completed an evaluation of Java, Groovy and Scala. The factors I considered were: readability, precision The factors I would like to know: performance, ease of integration I needed a BigDecimal level of precision. Here are my results: Java void someOp() { BigDecimal del_theta_1 = toDec(6); BigDecimal del_theta_2 = toDec(2); BigDecimal del_theta_m = toDec(0); del_theta_m = abs(del_theta_1.subtract(del_theta_2)) .divide(log(del_theta_1.divide(del_theta_2))); } Groovy void someOp() { def del_theta_1 = 6.0 def del_theta_2 = 2.0 def del_theta_m = 0.0 del_theta_m = Math.abs(del_theta_1 - del_theta_2) / Math.log(del_theta_1 / del_theta_2); } Scala def other(){ var del_theta_1 = toDec(6); var del_theta_2 = toDec(2); var del_theta_m = toDec(0); del_theta_m = ( abs(del_theta_1 - del_theta_2) / log(del_theta_1 / del_theta_2) ) } Note that in Java and Scala I used static imports. Java: Pros: it is Java Cons: no operator overloading (lots o methods), barely readable/codeable Groovy: Pros: default BigDecimal means no visible typing, least surprising BigDecimal support for all operations (division included) Cons: another language to learn Scala: Pros: has operator overloading for BigDecimal Cons: some surprising behaviour with division (fixed with Decimal128), another language to learn

    Read the article

  • How to stop moving the image in objective c?

    - by user1589452
    I have done a coding to check whether the image crossed particular area or not, -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint loc=[touch locationInView:self.view]; if (touch.view==img2Obj) { NSLog(@"image2"); img2Obj.center=loc; currentx1=img2Obj.frame.origin.x; currenty1=img2Obj.frame.origin.y; //NSLog(@"top left corner x and y is %.1f and %.1f",img2Obj.frame.origin.x,img2Obj.frame.origin.y); [self isImg1InPos]; }} -(void)isImg1InPos { int dx,dy; dx=currentx1-x1; dy=currenty1-y1; if (abs(dx)<5 && abs(dx)<5) { NSLog(@"Image must stop moving after this!!!"); [img2Obj setUserInteractionEnabled:FALSE]; } //NSLog(@"unsigned int is %d",abs(dx)); } I want the image to stop moving when when it passes the condition. [img2Obj setUserInteractionEnabled:FALSE]; But its not working, can anyone tell me how to solve this problem Many thanks in advance

    Read the article

  • Drawing straight lines in JavaScript

    - by Shawn31313
    I'm just trying to draw a line with JavaScript. I would like it to be like this: http://deepliquid.com/projects/blog/arrows2.html My version: http://jsfiddle.net/shawn31313/qsWML/5/show Doesn't work too well and I don't know how to get it too work. It must be an issue in my JavaScript. This my code: $(document).ready(function() { var dragStatus = 2, getPos, giveRandomID; $(document).mousedown(function(event) { dragStatus = 0; getPos = { top: event.clientY, left: event.clientX }; giveRandomID = Math.floor(Math.random() * 99999); }); $(document).mousemove(function() { var line = $('#line' + giveRandomID); if (dragStatus == 0) { $('body').append("<div id='line" + giveRandomID + "' style='position:absolute;top:" + getPos.top + "px;left:" + getPos.left + "px;background:black;width:2px;height:5px'></div>"); dragStatus = 1; } if (dragStatus == 1) { if (event.clientX > getPos.left) { line.css({ left: getPos.left, width: event.clientX - getPos.left }); } else { line.css({ left: event.clientX, width: getPos.left - event.clientX }); } if (event.clientY > getPos.top) { line.css({ top: getPos.top - Math.abs((event.clientY - getPos.top) * 2), '-webkit-transform': 'rotate(' + (event.clientY - getPos.top) + 'deg)' }); } else { line.css({ top: getPos.top + Math.abs((getPos.top - event.clientY) * 2), '-webkit-transform': 'rotate(' + (getPos.top - event.clientY) + 'deg)' }); } //for DEG "-" Top-Math.abs(DEG*2) for Deg "+" Top+(DEG*2) } }); $(document).mouseup(function() { dragStatus = 2; }); });? Thanks for any help fixing this. Mainly an issue with the math, just don't know how I can fix this.

    Read the article

  • Excel COM - Unable to get the Open property of the Workbooks class?

    - by Abs
    Hello all, I have tried this and I get this error: $excel_app = new COM("Excel.Application") or Die ("Did not connect"); $Workbook = $excel_app->Workbooks->Open('Variables.xls') or Die('Did not open filename'); I get this error: Unable to get the Open property of the Workbooks class What does this error mean? In addition, is there an API or a function list for accessing excel via COM. Thanks all Update Full error: exception 'com_exception' with message 'Source: Microsoft Excel Description: Unable to get the Open property of the Workbooks class' in C:\excel.php:22 Stack trace: #0 C:\excel.php(22): variant->Open('C:\...') #1 {main}

    Read the article

  • Consumed WCF service returns void although return type (& value) specified

    - by Abs
    I have a WCF service that I am attempting to connect to via a console application for testing (although will move to WPF for the final interface). I have generated the proxy, added the service reference to my project in visual studio and I can see all the methods I have created in my WCF interface: SupportStaffServiceClient client = new SupportStaffServiceClient("WSHttpBinding_ISupportStaffService"); client.myMethod(message); However when I call a method, which in the WCF interface is specified as returning a value, the method returns void in the console application. client.getMethod(message); The WCF service method is definitely returning a message, I'm just unsure as to why the client cannot "see" the return.

    Read the article

  • Finding and Printing all Links within a DIV

    - by Abs
    Hello all, I am trying to find all links in a div and then printing those links. I am using the Simple HTML Dom to parse the HTML file. Here is what I have so far, please read the inline comments and let me know where I am going wrong. include('simple_html_dom.php'); $html = file_get_html('tester.html'); $articles = array(); //find the div the div with the id abcde foreach($html->find('#abcde') as $article) { //find all a tags that have a href in the div abcde foreach($article->find('a[href]') as $link){ //if the href contains singer then echo this link if(strstr($link, 'singer')){ echo $link; } } } What currently happens is that the above takes a long time to load (never got it to finish). I printed what it was doing in each loop since it was too long to wait and I find that its going through things I don't need it to! This suggests my code is wrong. The HTML is basically something like this: <div id="abcde"> <!-- lots of html elements --> <!-- lots of a tags --> <a href="singer/tom" /> <img src="image..jpg" /> </a> </div> Thanks all for any help

    Read the article

  • PHP, Codeigniter: How to Set Date/Time based on users timezone/location globally in a web app?

    - by Abs
    Hello all, I have just realised if I add a particular record to my MySQL database - it will have a date/time of the server and not the particular user and where they are located which means my search function by date is useless! As they will not be able to search by when they have added it in their timezone rather when it was added in the servers timezone. Is there a way in Codeigniter to globally set time and date specific to a users location (maybe using their IP) and every time I call date() or time() that users timezone is used. What I am actually asking for is probably how to make my application dependent on each users timezone? Maybe its better to store each users timezone in their profile and have a standard time (servers time) and then convert the time to for each user? Thanks all

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >