Search Results

Search found 3846 results on 154 pages for 'life sciences'.

Page 14/154 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Make a lives display in HUD, Flash AS3 (not text!)

    - by user40404
    I've been searching the internet all day and I can't find the answer I'm looking for. In my HUD I want to use orange dots to represent lives. The user starts off with 5 lives and every time they die, I want a dot to be removed. Pretty straight forward. So far my idea is to make a movie clip that has the five dots in a line. There would be 5 frames on the timeline (because after the last life it goes to a game over screen right away). I would have a variable set up to store the number of lives and a function to keep track of lives. So every hit of an obstacle would result in livesCounter--;. Then I would set up something like this: switch(livesCounter){ case 5: livesDisplay.gotoAndPlay(1); break; case 4: livesDisplay.gotoAndPlay(2); break; case 3: livesDisplay.gotoAndPlay(3); break; case 2: livesDisplay.gotoAndPlay(4); break; case 1: livesDisplay.gotoAndPlay(5); break; } I feel like there has to be an easier way to do this where I could just have a movie clip of a single orange dot that I could replicate across an x value based on the number of lives. Maybe the dots would be stored in an array? When the user loses a life, a dot on the right end of the line is removed. So in the end the counter would look like this: * * * * * * * * * * * * * * * (last life lost results in the end game screen) EDIT: code based on suggestions by Zhafur and Arthur Wolf White package { import flash.display.MovieClip; import flash.events.*; import flash.ui.Multitouch; import flash.ui.MultitouchInputMode; import flash.display.Sprite; import flash.text.*; import flash.utils.getTimer; public class CollisionMouse extends MovieClip{ public var mySprite:Sprite = new Sprite(); Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT; public var replacement:newSprite = new newSprite; public var score:int = 0; public var obstScore:int = -50; public var targetScore:int = 200; public var startTime:uint = 0; public var gameTime:uint; public var pauseScreen:PauseScreen = new PauseScreen(); public var hitTarget:Boolean = false; public var hitObj:Boolean = false; public var currLevel:Number = 1; public var heroLives:int = 5; public var life:Sprite; public function CollisionMouse() { mySprite.graphics.beginFill(0xff0000); mySprite.graphics.drawRect(0,0,40,40); addChild(mySprite); mySprite.x = 200; mySprite.y = 200; pauseScreen.x = stage.width/2; pauseScreen.y = stage.height/2; life = new Sprite(); life.x = 210; stage.addEventListener(MouseEvent.MOUSE_MOVE,followMouse); /*mySprite.addEventListener(TouchEvent.TOUCH_END, onTouchEnd);*/ //checkLevel(); timeCheck(); trackLives(); } public function timeCheck(){ addEventListener(Event.ENTER_FRAME, showTime); } public function showTime(e:Event) { gameTime = getTimer()-startTime; rm1_mc.timeDisplay.text = clockTime(gameTime); rm1_mc.livesDisplay.text = String(heroLives); } public function clockTime(ms:int) { var seconds:int = Math.floor(ms/1000); var minutes:int = Math.floor(seconds/60); seconds -= minutes*60; var timeString:String = minutes+":"+String(seconds+100).substr(1,2); return timeString; } public function trackLives(){ for(var i:int=0; i<heroLives; i++){ life.graphics.lineStyle(1, 0xff9900); life.graphics.beginFill(0xff9900, 1); life.graphics.drawCircle(i*15, 45, 6); life.graphics.endFill(); addChild(life); } } function followMouse(e:MouseEvent){ mySprite.x=mouseX; mySprite.y=mouseY; trackCollisions(); } function trackCollisions(){ if(mySprite.hitTestObject(rm1_mc.obst1) || mySprite.hitTestObject(rm1_mc.obst2)){ hitObjects(); } else if(mySprite.hitTestObject(rm1_mc.target_mc)){ hitTarg(); } } function hitObjects(){ addChild(replacement); mySprite.x ^= replacement.x; replacement.x ^= mySprite.x; mySprite.x ^= replacement.x; mySprite.y ^= replacement.y; replacement.y ^= mySprite.y; mySprite.y ^= replacement.y; stage.removeEventListener(MouseEvent.MOUSE_MOVE, followMouse); removeChild(mySprite); hitObj = true; checkScore(); } function hitTarg(){ addChild(replacement); mySprite.x ^= replacement.x; replacement.x ^= mySprite.x; mySprite.x ^= replacement.x; mySprite.y ^= replacement.y; replacement.y ^= mySprite.y; mySprite.y ^= replacement.y; stage.removeEventListener(MouseEvent.MOUSE_MOVE, followMouse); removeEventListener(Event.ENTER_FRAME, showTime); removeChild(mySprite); hitTarget = true; currLevel++; checkScore(); } function checkScore(){ if(hitObj){ score += obstScore; heroLives--; removeChild(life); } else if(hitTarget){ score += targetScore; } rm1_mc.scoreDisplay.text = String(score); rm1_mc.livesDisplay.text = String(heroLives); trackLives(); } } }

    Read the article

  • My self-generated CA is nearing it's end-of-life; what are the best practices for CA-rollover?

    - by Alphager
    Some buddies and me banded together to rent a small server to use for email, web-hosting and jabber. Early on we decided to generate our own Certificate Authority(CA) and sign all our certificates with that CA. It worked great! However, the original CA-cert is nearing it's end-of-life (it expires in five months). Obviously, we will have to generate a new cert and install it on all our computers. Are there any best practices we should follow? We have to re-generate all certs and sign them with the new CA, right?

    Read the article

  • What is the life cycle of the XNA GraphicsDevice on the Xbox 360?

    - by David Brown
    I'm working on an XNA project that doesn't use the built-in Game class, mostly for learning purposes (so I can mess with different game loop types, etc). It's only designed for the Xbox 360, because the hardware is consistent and I don't have to worry about compatibility among different PC hardware configurations. So far, it's working well and I can clear the screen to a color, but I'd like to make sure I handle the GraphicsDevice correctly before moving on. What exactly is the life cycle for the GraphicsDevice on the Xbox 360? Is it ever lost or reset automatically? I know that on Windows, it's lost when the window loses focus, but the Xbox obviously doesn't manage focus. It appears to even keep the graphics device when the Guide pops up, which is the closest thing I can find to "losing focus" on the Xbox. I'd like to think it's simply a matter of "fire and forget," which would make a lot of other things much easier (only needing to load content once, for instance). But I want to make sure.

    Read the article

  • Global variable life in Javascript - destroyed on a reload?

    - by Paul Nathan
    (I am learning Javascript) Problem: A page I am working on has 2 views, a data entry view with a textbox and a data rendering view. There is a a href src="currentpage#" link that switches between the 2 views. In order to transmit data from view to view, the javascript parses it from the current HTML and pushes it into the correct form for the other view. This is ugly and I want to refactor it out, ideally into some sort of global where it can be neatly rendered down into the view on command (I'm refactoring the code base to a point where I can AJAX it from a server). However, I am not certain about scoping rules and variable life in JS.

    Read the article

  • Are there any real life uses for the Java byte primitive type?

    - by Thorbjørn Ravn Andersen
    For some inexplicable reason the byte primitive type is signed in Java. This mean that valid values are -128..127 instead of the usual 0..255 range representing 8 significant bits in a byte (without a sign bit). This mean that all byte manipulation code usually does integer calculations and end up masking out the last 8 bits. I was wondering if there is any real life scenario where the Java byte primitive type fits perfectly or if it is simply a completely useless design decision? EDIT: The sole actual use case was a single-byte placeholder for native code. In other words, not to be manipulated as a byte inside Java code.

    Read the article

  • vmware server end of life, where to go now?

    - by matnagel
    We have some virtual machines on vmware server 2.x running on 64 bit hardware and quite happy with it. As vmware server will no longer be offered we are thinking to migrate to ESXi, which seems is free. We will have to install the specialized network cards but that's a minor problem. But once left alone with a quite silently discontinued product there is some resistance to vmware. VirtualBox seems to work: http://blogs.oracle.com/virtualization/2010/06/migrating_from_vmware_to_virtu.html What other free (of licencing cost) options are there? We have windows server 2003 32 bit VMs and also linux 32 and 64 bit VMs to migrate. So xen does not seem an option, which does not run microsoft OSes.

    Read the article

  • Explanation of WCF application life cycle in IIS 6 hosting environment.

    - by David Christiansen
    Hi all and thanks for reading, I have a delay issue where my application takes a long time to start up when first called after an determinate period since the last call. The web application is a WCF service and we are talking about a delay of ~18seconds before the actual processing starts. Now, I believe I know how to reduce this delay so that is not my question (it's more a stackoverflow deal anyway) My question is, Can anyone explain to me why is it that despite me disabling worker process shutdown, and worker process recycling the application still 'winds down' after a indeterminate period of time of inactivity? To understand this I need to know more about the innerworkings of WCF services hosted in IIS. I fully expect there to be a straight forward answer to this. Thank you v. much for any help you may offer, DC

    Read the article

  • What parts of a motherboard age, and how can I choose one with the longest possible life?

    - by Robert Harvey
    I have a home-built computer that's probably about four years old. I realize this probably seems ancient to some folks, but computers have no moving parts (except the fans), so theoretically they should last a long time, if I still have software to run on them. A few weeks ago, it began blue-screening and freezing up, with various error messages. It almost always happened about five minutes after startup. I assumed that the video card was overheating, since the cheap little fan on the heatsink died, so I replaced it. Long story short, after upgrading the video drivers a couple of times and performing some other troubleshooting, I remembered that the last time this happened, I took out the memory SIMS and cleaned the contacts with a gum eraser, so I did that again (noting that the SATA cables were very close to the chips on the SIMS). I re-routed the cables and reinstalled the SIMS. So far, so good; the machine has been trouble-free since. But blue-screens are distressing; I never know what bits are being chewed up in my OS installation when something like this happens. So I'm wondering if I'm choosing my components properly. If it matters, it's an Intel D915GAG motherboard and Corsair memory, but what I'm wondering is, should I be looking for certain characteristics when I choose these parts for my next computer, so that I can avoid this problem in my next build?

    Read the article

  • What is the easiest way to apply database functionality into my daily life?

    - by Daddy Warbox
    let me try to explain it by listing some of the things I want to do: Submit random thoughts, notes, facts, and to-do tasks of any sort and at any time. Tag each of these submissions freely. Manage these tags centrally. Associate meta-data with submissions and tags. Search, filter, and sort submissions. I want lots of power here. Display views of submissions (including within searches) in a hierarchy. Create said hierarchies easily out by ordering relevant tags. I'm thinking towards some kind of desktop program that allows me to quickly do all of these things. A web service could also work, too, but it will need offline capabilities. I don't want to have to pay for this, if that's possible. Also, as I know regex and SQL, I wouldn't mind solutions involving the use of either.

    Read the article

  • What components should I upgrade to squeeze more life of my pc? [on hold]

    - by Jared
    Hi my current specs are CPU: Intel Core i5 750 2.66 GHz, Socket 1156 Motherboard: Asus P7P55 LX Motherboard, Socket 1156, 4xDIMM DDR3, 2xPCIe-16, 3xPCI, 2xPCIe-1, 14xUSB2, Audio, 1xATA, 6xSATA, RAID, ATX HDD: Seagate Barracuda 7200.11 ST31500341AS Hard Disk Drive, 1500GB, 7200rpm, 32MB Cache, SATA-2 RAM: G.Skill Ripjaw F3-12800CL8D-4GBRM, 2x2GB, DDR3-1600, PC3-12800, CL8, DIMM Video: MSI Radeon 5850 R5850-PM2D1G Video Card, 1024MB, DDR5, PCIe-16, DVI, CrossFire, HDMI PSU: Vantec ION2, 620W ATX PSU, SLI Ready, Black Firstly I know it badly needs an SSD, for which I'm thinking of the Samsung 250gb 840 EVO series. The ram could do with another 4GB, for which I am thinking of replacing the 2x2GB for 2x4GB of the same type. My video card is struggling with the latest releases, so vitally should I ditch the video card and go for something newer (ATI 7850, GTX 660?) or try and get another 5850 for crossfire support? Bearing in mind 5850's are sort of hard to come buy now as they are not stocked in shops usually, which means they have to be bought second hand.

    Read the article

  • Cladogram, tree of life, cladistics, taxonomy in JS or canvas?

    - by boblet
    Good people - I need some help to find a way to create an interactive cladogram or phylogenetic tree (yes, I have read all related posts, and do not find what I am looking for). The thing is, I need the nodes to be name-able. An example would be something like this Most scripts I find are either applets, flash, or simply do not show the node classification, ie it would skip "feliformia" in this example. This is useless to me, as I would then end up with carnivore - anonymous node - anonymous node - anonymous node - tiger, and that is not good. This tree will in theory cover all life, so it could get rather large, and get links and names in english and latin from database. So: no flash, no applets. It must be horizontal, no supertrees (circular). I have gone through this http://bioinfo.unice.fr/biodiv/Tree_editors.html but most of them seems to be either old, not displaying sub-node levels, applets, or way too complex. I imagine this would be a delightful job for canvas/jQuery..? And chances are, someone got there before me? Any pointers much appreciated. Note: if anyone out there would like to do something like this as a project, I will be happy to help, even though it would not benefit me for this project.This type of taxonomy is not as simple as it may seem, and I would be happy see this happen.

    Read the article

  • How to optimize Conway's game of life for CUDA?

    - by nlight
    I've written this CUDA kernel for Conway's game of life: global void gameOfLife(float* returnBuffer, int width, int height) { unsigned int x = blockIdx.x*blockDim.x + threadIdx.x; unsigned int y = blockIdx.y*blockDim.y + threadIdx.y; float p = tex2D(inputTex, x, y); float neighbors = 0; neighbors += tex2D(inputTex, x+1, y); neighbors += tex2D(inputTex, x-1, y); neighbors += tex2D(inputTex, x, y+1); neighbors += tex2D(inputTex, x, y-1); neighbors += tex2D(inputTex, x+1, y+1); neighbors += tex2D(inputTex, x-1, y-1); neighbors += tex2D(inputTex, x-1, y+1); neighbors += tex2D(inputTex, x+1, y-1); __syncthreads(); float final = 0; if(neighbors < 2) final = 0; else if(neighbors 3) final = 0; else if(p != 0) final = 1; else if(neighbors == 3) final = 1; __syncthreads(); returnBuffer[x + y*width] = final; } I am looking for errors/optimizations. Parallel programming is quite new to me and I am not sure if I get how to do it right. The rest of the app is: Memcpy input array to a 2d texture inputTex stored in a CUDA array. Output is memcpy-ed from global memory to host and then dealt with. As you can see a thread deals with a single pixel. I am unsure if that is the fastest way as some sources suggest doing a row or more per thread. If I understand correctly NVidia themselves say that the more threads, the better. I would love advice on this on someone with practical experience.

    Read the article

  • Python: Recursively access dict via attributes as well as index access?

    - by Luke Stanley
    I'd like to be able to do something like this: from dotDict import dotdictify life = {'bigBang': {'stars': {'planets': [] } } } dotdictify(life) #this would be the regular way: life['bigBang']['stars']['planets'] = {'earth': {'singleCellLife': {} }} #But how can we make this work? life.bigBang.stars.planets.earth = {'singleCellLife': {} } #Also creating new child objects if none exist, using the following syntax life.bigBang.stars.planets.earth.multiCellLife = {'reptiles':{},'mammals':{}} My motivations are to improve the succinctness of the code, and if possible use similar syntax to Javascript for accessing JSON objects for efficient cross platform development.(I also use Py2JS and similar.)

    Read the article

  • When Google gives up recrawling 301 that led to 404?

    - by Easy Life
    I've transferred a domain and made a mistake in the redirects (the URL structure is identical). Even though they went to the new domain, the error caused a 404 when crawled by Google bot. 10 days after I saw and corrected my redirect mistake, and now the site should (hopefully) redirect to proper pages. Q1: The URLs of the 404 pages in the Webmaster Tools all bear the mistake and will never be available at the new site. I marked them as fixed in the tools. Do I need to do something about that, like 301 rewrite them with a condition to fix the error? Q2: Does Google bot attempt to recrawl 301 pages that pointed to a 404?

    Read the article

  • When I add a database table to a DBML file via LINQ to SQL, I get a slew of compiler errors.

    - by Zian Choy
    Whenever I add a certain table to a DBML file via LINQ to SQL, I get 102 errors in my VB NET project. Some of the errors: Error 1 Attribute 'TableAttribute' cannot be applied multiple times. C:\Documents and Settings\zchoy\My Documents\Virtual EMS Deployment\Life And Death\Life And Death\ShearwaterEMS.designer.vb 74 2 EMS Reality Check Error 2 'emptyChangingEventArgs' is already declared as 'Private Shared emptyChangingEventArgs As System.ComponentModel.PropertyChangingEventArgs' in this class. C:\Documents and Settings\zchoy\My Documents\Virtual EMS Deployment\Life And Death\Life And Death\ShearwaterEMS.designer.vb 78 17 EMS Reality Check Error 3 '_GroupID' is already declared as 'Private _GroupID As Integer' in this class. C:\Documents and Settings\zchoy\My Documents\Virtual EMS Deployment\Life And Death\Life And Death\ShearwaterEMS.designer.vb 80 10 EMS Reality Check Error 4 '_ID' is already declared as 'Private _ID As Integer' in this class. C:\Documents and Settings\zchoy\My Documents\Virtual EMS Deployment\Life And Death\Life And Death\ShearwaterEMS.designer.vb 82 10 EMS Reality Check Any suggestions for getting the table to work with LINQ to SQL will be welcomed. The table's properties: Group ID ID (Primary Key) Contact Title UseGroupAddress InternationalFormat Address1 Address2 City State ZipCode Country Phone Fax EMailAddress Notes DateAdded AddedBy DateChanged ChangedBy Active ExternalReference ChangeCounter PhoneLabel FaxLabel

    Read the article

  • What trivial real-life example do you use to explain programming to total non-programmers?

    - by anon
    Programmers seem to live in a world of their own (as this site indicates), with their own vibrant culture - and their own premises and vocabulary. Once we've been in the field for a bit, we take a lot of things for granted. But I'm often faced with the question "What do you do?" Or "What is programming?" I generally try to answer this with a small, often trivial, real-world example of how programming is prevalent in our everyday lives and keeps things running. The example I use most often is an elevator - someone has to program the logic of that... And I've seen elevators that are "smart" and ones that are quite backwards and foolish. (And you can easily understand if/decision and looping from that... incorporates a lot of important programming concepts in a very small example.) I've sometimes heard people use traffic lights as an example. What example do you / would you use to explain the concept of programming to someone completely clueless?

    Read the article

  • Is regex too slow? Real life examples where simple non-regex alternative is better

    - by polygenelubricants
    I've seen people here made comments like "regex is too slow!", or "why would you do something so simple using regex!" (and then present a 10+ lines alternative instead), etc. I haven't really used regex in industrial setting, so I'm curious if there are applications where regex is demonstratably just too slow, AND where a simple non-regex alternative exists that performs significantly (maybe even asymptotically!) better. Obviously many highly-specialized string manipulations with sophisticated string algorithms will outperform regex easily, but I'm talking about cases where a simple solution exists and significantly outperforms regex. What counts as simple is subjective, of course, but I think a reasonable standard is that if it uses only String, StringBuilder, etc, then it's probably simple.

    Read the article

  • How to handle activity life cycle involving sockets in Android?

    - by Henrik
    Hello all, I have an Android activity which in turn starts a thread. In the thread I open a persistent TCP socket connection. When the socket connects to the server dynamic data is downloaded. The thread sends messages using Handler-class to the activity when data has been received. Now if the user happens to switch from portrait to landscape mode the activity gets an onDestroy call. At this moment I close the socket and stop the thread. When Android has switched landscape mode it calls onCreate yet again and I have to do a socket re-connect. Also, all of the data the activity received needs to be downloaded once more because the server does not have the ability to know what has been sent before, i.e. there is no "resume" feature. Thus the problem is that there is alot of data which is resent all the time when landscape mode is changed. What are my options here? Should I create a service which handles the socket traffic towards the server thus I always got all the data which the server has sent in the service. Or should I disable landscape mode all together perhaps? Or would my best bet be to rewrite my server which is a VERY BIG job :-) All input is welcome :-) / Henrik

    Read the article

  • Windows Forms Dead. Long life to WPF.

    - by pho3nix
    In PDC sessions i see only Framework 4.0, Azure and WPF. My all applications is in windows forms and asp.net (codebehind) and framework 2.0 or 3.5. I see i'am obsolete, ok. But my questions is Windows Forms is dead, i need start migrate to WPF or Silverlight? or my Windows forms with Devexpress can leave more than 3 years?

    Read the article

  • IE7 is making my life miserable! Getting gaps between html table columns (w/ colspan) with css togg

    - by Art Peterson
    Copy/paste this html code snippet and try it out in IE7. When you toggle the hidden columns it leaves a gap between the columns. In Firefox it works fine, the columns touch when minimized. Haven't tried IE8 yet, would be curious to hear how it works there. Any ideas? I've tried a bunch of things in the CSS like table-layout:fixed but no luck. Note: Not looking for a different toggling method because the table I'm really dealing with is 50+ columns wide and 4000+ rows so looping/jquery techniques are too slow. Here's the code - if someone can re-post a working version of it I'll instantly give them the check and be forever in your debt! <DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <script> function toggle() { var tableobj = document.getElementById("mytable"); if (tableobj.className == "") { tableobj.className = "hide1 hide2"; } else { tableobj.className = ""; } } </script> <style> table { border-collapse: collapse; } td, th { border: 1px solid silver; } .hide1 .col1 { display: none; } .hide2 .col2 { display: none; } </style> </head> <body> <input type="button" value="toggle" onclick="toggle();" /> <table id="mytable"> <tr> <th>A</th> <th colspan="2">B</th> <th colspan="2" class="col1">B1</th> <th colspan="2">C</th> <th colspan="2" class="col2">C1</th> </tr> <tr> <td>123</td> <td>456</td> <td>789</td> <td class="col1">123</td> <td class="col1">456</td> <td>789</td> <td>123</td> <td class="col2">456</td> <td class="col2">789</td> </tr> </table> </body> </html>

    Read the article

  • Retain, alloc, properties ... Topic to make your Obj-c life easier !

    - by gotye
    Hey everyone, The more I code, the more I get lost ... so I decided to create a topic entirely dedicated to the memory management for me (and others) not to waste hours understanding obj-c basics ... I'll update it as new questions are asked ! Okay below is some examples : // myArray is property (retain) myArray = otherArray; //myArray isn't a property myArray = otherArray; //myArray is a property (retain) myArray = [[NSArray alloc] init]; //myArray isn't a property myArray = [[NSArray alloc] init]; Could you explain to me what happens in every cases ? And especially the number 3 ;) Thanks for the time. Gotye.

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >