Daily Archives

Articles indexed Saturday April 17 2010

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

  • strings and textfields, AS3

    - by VideoDnd
    How do I get my text fields to populate correctly and show single digits? Description Each textfield receives a substring. This doesn't limit it's input, because the text fields shows extra numbers. See illustration. Ex A //Tweening method 'could substitute code with Tweener' import fl.transitions.Tween; import fl.transitions.easing.*; //Timer that will run a sec and repeat var timer:Timer = new Timer(1000); //Integer values var count:int = +220000000; var fcount:int = 0; //Events and starting timer timer.addEventListener(TimerEvent.TIMER, incrementCounter); addEventListener(Event.ENTER_FRAME, checkOdometerPosition); timer.start(); //Tween Variables var smoothLoop:int = 0; var originalYPosition:Number = 0; var upwardYPosition:Number = -99; //Formatting String function formatCount(i:int):String { var fraction:int = i % 100; var whole:int = i / 100; return ("0000000" + whole).substr(-7, 7) + "." + (fraction < 10 ? "0" + fraction : fraction); } //First Digit 'trigger set by using var upwardPosition as a constant' function checkOdometerPosition(event:Event):void{ if (seconds9.y <= upwardYPosition){ var toText:String = formatCount(fcount); //seconds9.firstDigit.text = formatCount(fcount); seconds9.firstDigit.text = toText.substr(9, 9); seconds9.y = originalYPosition; seconds8.firstDigit.text = toText.substr(8, 8); seconds8.y = originalYPosition; seconds7dec.firstDigit.text = toText.substr(7, 7); seconds7dec.y = originalYPosition; seconds6.firstDigit.text = toText.substr(6, 6); seconds6.y = originalYPosition; seconds5.firstDigit.text = toText.substr(5, 5); seconds5.y = originalYPosition; seconds5.firstDigit.text = toText.substr(4, 4); seconds5.y = originalYPosition; seconds3.firstDigit.text = toText.substr(3, 3); seconds3.y = originalYPosition; seconds2.firstDigit.text = toText.substr(2, 2); seconds2.y = originalYPosition; seconds1.firstDigit.text = toText.substr(1, 1); seconds1.y = originalYPosition; seconds1.firstDigit.text = toText.substr(1, 1); seconds1.y = originalYPosition; seconds0.firstDigit.text = toText.substr(0, 1); seconds0.y = originalYPosition; } } //Second Digit function incrementCounter(event:TimerEvent):void{ count++; fcount=int(count) if (smoothLoop < 9){ smoothLoop++; } else { smoothLoop = 0; } var lolly:String = formatCount(fcount-1); //seconds9.secondDigit.text = formatCount(fcount); seconds9.secondDigit.text = lolly.substr(9, 9); var addTween9:Tween = new Tween(seconds9, "y", Strong.easeOut,0,-222, .7, true); seconds8.secondDigit.text = lolly.substr(8, 8); var addTween8:Tween = new Tween(seconds8, "y", Strong.easeOut,0,-222, .7, true); seconds7dec.secondDigit.text = lolly.substr(7, 7); var addTween7dec:Tween = new Tween(seconds7dec, "y", Strong.easeOut,0,-222, .7, true); seconds6.secondDigit.text = lolly.substr(6, 6); var addTween6:Tween = new Tween(seconds6, "y", Strong.easeOut,0,-222, .7, true); seconds5.secondDigit.text = lolly.substr(5, 5); var addTween5:Tween = new Tween(seconds5, "y", Strong.easeOut,0,-222, .7, true); seconds4.secondDigit.text = lolly.substr(4, 4); var addTween4:Tween = new Tween(seconds4, "y", Strong.easeOut,0,-222, .7, true); seconds3.secondDigit.text = lolly.substr(3, 3); var addTween3:Tween = new Tween(seconds3, "y", Strong.easeOut,0,-222, .7, true); seconds2.secondDigit.text = lolly.substr(2, 2); var addTween2:Tween = new Tween(seconds2, "y", Strong.easeOut,0,-222, .7, true); seconds1.secondDigit.text = lolly.substr(1, 1); var addTween1:Tween = new Tween(seconds1, "y", Strong.easeOut,0,-222, .7, true); seconds0.secondDigit.text = lolly.substr(0, 1); var addTween0:Tween = new Tween(seconds0, "y", Strong.easeOut,0,-222, .7, true); } Ex A has 10 text objects, each with a pair of text fields. It’s move complex than Ex B, because it has a Y animation and pairs of numbers. The text objects are animated to create a scrolling effect. It moves vertically, and has a lead number and a catch up number contained in each symbol. See illustration for more description. The counters are set to 2,200,000.00, just to see if the numbers are populating. Ex B work fine! for example only //STRING SPLITTER COUNTER with nine individual text fields //Timer settings var delay:uint = 1000/100; var repeat:uint = 0; var timer:Timer; timer = new Timer(delay,repeat); timer.addEventListener(TimerEvent.TIMER, incrementCounter); timer.start(); //Integer values var count:int = 0; var fcount:int = 0; //Format Count function formatCount(i:int):String { var fraction:int = i % 100; var whole:int = i / 100; return ("0000000" + whole).substr(-7, 7) + "." + (fraction < 10 ? "0" + fraction : fraction); } //Split strings off to individual text fields function incrementCounter(event:TimerEvent) { count++; fcount=int(count+220000000) var toText:String = formatCount(fcount); mytext9.text = toText.substr(9, 9); mytext8.text = toText.substr(8, 8); mytext7dec.text = toText.substr(7, 7); mytext6.text = toText.substr(6, 6); mytext5.text = toText.substr(5, 5); mytext4.text = toText.substr(4, 4); mytext3.text = toText.substr(3, 3); mytext2.text = toText.substr(2, 2); mytext1.text = toText.substr(1, 1); mytext0.text = toText.substr(0, 1); } Here's a link to the files

    Read the article

  • Query results taking too long on 200K database, speed up tips?

    - by colorfulgrayscale
    I have a sql statement where I'm joining about 4 tables, each with 200K rows. The query runs, but keeps freezing. When I do a join on 3 tables instead, it returns the rows (takes about 10secs). Any suggestion why? suggestions to speed up? Thanks! Code SELECT * FROM equipment, tiremap, workreference, tirework WHERE equipment.tiremap = tiremap.`TireID` AND tiremap.`WorkMap` = workreference.`aMap` AND workreference.`bMap` = tirework.workmap LIMIT 5 p.s and if it helps any, I'm using sql alchemy to generate this code, the sqlalchemy code for this is query = session.query(equipment, tiremap, workreference, tirework) query = query.filter(equipment.c.tiremap == tiremap.c.TireID) query = query.filter(tiremap.c.WorkMap==workreference.c.aMap) query = query.filter(workreference.c.bMap == tirework.c.workmap) query = query.limit(5) query.all()

    Read the article

  • Dynamically change my schema

    - by Kirk
    I am wondering if there is a way to change the schema that I am working in while inside Management Studio. For instance I may have a default schema of dbo. But there are times I may want to query objects in say the accounting schema. It would be nice if I could issue a command and make it so I no longer must include the accounting before tables and views. But the next time I go in, I will be back to default of dbo.

    Read the article

  • restrict script inside iframe to run only within pages of same top-level domain?

    - by Justin Grant
    I'd like to enforce a requirement that client script inside a page (which in turn is loaded inside an iframe of another page) will only run when the parent page is on the same top-level domain as the framed page (although it may be on another hostname in that domain). Is this do-able? I assume that the easy solution of looking at top.location.host won't be available due to cross-site scripting limitations, but I'm wondering if other javascript hackery could suffice. Constraints on any potential solution inculde: I need to be able to run XmlHttpRequest calls inside the child page, and I need to validate that the hostname is in the same domain before I make those calls. (this makes a document.domain solution challenging because AFAIK setting document.domain disables the ability to make XmlHttpRequest calls. I can control client-side script and HTML on both parent or child (and I can create new pages if needed), but I can't make any server-side code changes. I can't simulate the above via server-side calls or proxies, because the child page's hostname uses a forms auth system with hostname-scoped cookies that I can't get access to from the parent page since it's on a different hostname. I don't have enough control over the child-frame site to be able to put both sites behind the same reverse-proxy or load-balancer (which would enable me to put both sites on the same hostname). I don't actually need to access any UI inside the IFrame-- the iframe is invisible and I'm only using it to run javascript within the security context of a site on a different hostname from the parent page. So at this point I'm stumped. Got any ideas? I want to make sure I'm not overlooking an easy solution before giving up.

    Read the article

  • XNA Alpha Blending to make part of a texture transparent

    - by David
    What I am trying to do is use alpha blending in XNA to make part of a drawn texture transparent. So for instance, I clear the screen to some color, lets say Blue. Then I draw a texture that is red. Finally I draw a texture that is just a radial gradient from completely transparent in the center to completely black at the edge. What I want is the Red texture drawn earlier to be transparent in the same places as the radial gradient texture. So you should be able to see the blue back ground through the red texture. I thought that this would work. GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteBlendMode.None); spriteBatch.Draw(bg, new Vector2(0, 0), Color.White); spriteBatch.End(); spriteBatch.Begin(SpriteBlendMode.None); GraphicsDevice.RenderState.AlphaBlendEnable = true; GraphicsDevice.RenderState.AlphaSourceBlend = Blend.One; GraphicsDevice.RenderState.AlphaDestinationBlend = Blend.Zero; GraphicsDevice.RenderState.SourceBlend = Blend.Zero; GraphicsDevice.RenderState.DestinationBlend = Blend.One; GraphicsDevice.RenderState.BlendFunction = BlendFunction.Add; spriteBatch.Draw(circle, new Vector2(0, 0), Color.White); spriteBatch.End(); GraphicsDevice.RenderState.AlphaBlendEnable = false; But it just seems to ignore all my RenderState settings. I also tried setting the SpriteBlendMode to AlphaBlend. It blends the textures, but that is not the effect I want. Any help would be appreciated.

    Read the article

  • mingw32-make : "Input line too long" issue

    - by hjsblogger
    We have a Makefile which runs on a Windows 2003 machine and we are using mingw32-make for it. Since the Makefile has many include paths, it exceeds the buffer size of 8K that the cmd can handle [Ref - http://support.microsoft.com/kb/830473/EN-US/due to which the compilation results in "input line too long" issue. I wanted to know the following - What would be the best way to optimize the Makefile as I have already removed unwanted compiler switches, include paths etc. Is there any way we can put all the INCLUDE paths in one .txt file and import it in the Makefile.I could not find any mingw32 documentation for the same. Any other inputs/hints/reference links are most welcome. Thanks, -HJSblogger

    Read the article

  • mingw 3.4.5 missing dlfcn.h?

    - by lurscher
    Hi, is it possible that my mingw 3.4.5 installation is faulty? or is this provided on some other library floating around? in case you are wondering, dlfcn.h is where stuff like dlopen and dlclose are defined, so it should be pretty standard

    Read the article

  • Error in C Program

    - by Manoj
    Hi, while(((long)(1000*ratio*((long)clock()-(long)t0))%100)/1000)<Data_Read_Rate); The above line is generating the following error: "Syntax Error before < token". Why is this error coming up? I use MINGW32 for development(GCC compiler). Thanks...

    Read the article

  • Why should I Use ASP.NET Membership security model?

    - by ListenToRick
    I'm updating my website at the moment and figure that if I am to update my login/security mode, now is a good time. I have looked through the Membership model which is included in ASP.NET but I'm convinced that it will provide any benefit apart from being familiar to other .NET deevlopers. There seems to be quite a lot of documentation for it, but little discussion for why its worth the effort. Can anybody shed some light upon this?

    Read the article

  • Can ActionScript tell when a SWF was published?

    - by spiralganglion
    I'd like to write a little class that adds a Day/Month box showing the date a SWF was published from Flash. The company I work for regularly produces many, many SWFs and many versions of each, iterating over the course of months. A version-tracking system we've been using to communicate with our clients is a Day/Month date-box that gives the date the SWF was published. Up until now, we've been filling in the publish date by hand. If there's any way I can do this programatically with ActionScript that'd be fantastic. Any insight? Basically, all I need is the call that gives me the publish date, or even.. anything about the circumstances under which a SWF was published that I could use to roll into some form of.. automated version identification, unique to this SWF. So, can ActionScript tell when a SWF was published?

    Read the article

  • Opening Large (24 GB) File In C

    - by zacaj
    I'm trying to read in a 24 GB XML file in C, but it won't work. I'm printing out the current position using ftell() as I read it in, but once it gets to a big enough number, it goes back to a small number and starts over, never even getting 20% through the file. I assume this is a problem with the range of the variable that's used to store the position (long), which can go up to about 4,000,000,000 according to http://msdn.microsoft.com/en-us/library/s3f49ktz%28VS.80%29.aspx, while my file is 25,000,000,000 bytes in size. A long long should work, but how would I change what my compiler(Cygwin/mingw32) uses or get it to have fopen64?

    Read the article

  • Installing bitarray in Python 2.6 on Windows

    - by John Fouhy
    I would like to install bitarray in Windows running python 2.6. I have mingw32 installed, and I have C:\Python26\Lib\distutils\distutils.cfg set to: [build] compiler = mingw32 If I type, in a cmd.exe window: C:\Documents and Settings\john\My Documents\bitarray-0.3.5>python setup.py install I get: [normal python messages skipped] C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python26\include -IC:\Python26\PC -c bitarray/_bitarray.c -o build\temp.win32-2.6\Release\bitarray\_bitarray.o bitarray/_bitarray.c:2197: error: initializer element is not constant bitarray/_bitarray.c:2197: error: (near initialization for `BitarrayIter_Type.tp_getattro') bitarray/_bitarray.c:2206: error: initializer element is not constant bitarray/_bitarray.c:2206: error: (near initialization for `BitarrayIter_Type.tp_iter') bitarray/_bitarray.c:2232: error: initializer element is not constant bitarray/_bitarray.c:2232: error: (near initialization for `Bitarraytype.tp_getattro') bitarray/_bitarray.c:2253: error: initializer element is not constant bitarray/_bitarray.c:2253: error: (near initialization for `Bitarraytype.tp_alloc') bitarray/_bitarray.c:2255: error: initializer element is not constant bitarray/_bitarray.c:2255: error: (near initialization for `Bitarraytype.tp_free') error: command 'gcc' failed with exit status 1 Can anyone help?

    Read the article

  • toast style popup for my application

    - by anonym0use
    I have created an application that runs in the taskbar. When a user clicks the application it pops up etc. What I would like is similar functionality to that in MSN when one of my friends logs in. Apparently this is know as a toast popup? I basically want something to popup from every 20 minutes toast style fom the application in the taskbar. My existing application is winforms based written in C# with .net 3.5 Cheers

    Read the article

  • cross-compiling autoconf-based tools with mingw on Mac OS X

    - by paleozogt
    I'd like to cross-compile some open-source libraries (libiconv, gettext, glib2) for windows using mingw on Mac OS X. I've installed mingw on Mac with MacPorts. But now I'm not sure what to give to the configure script so that it will work. The cross-compilation tutorials I've seen all talk about makefiles, but no one mentions what to give autoconf-based projects. I'm configuring like this: ./configure --prefix=/opt/local/i386-mingw32 --host=i586-mingw32msvc but it doesn't seem to take. While the configure will pass, running "make" will give this error: i686-apple-darwin9-gcc-4.0.1: no input files I thought the "--host" argument to configure was supposed to tell it to use the mingw compiler? I'm not sure what's going on here.

    Read the article

  • Template class implicit copy constructor issues

    - by Nate
    Stepping through my program in gdb, line 108 returns right back to the calling function, and doesn't call the copy constructor in class A, like (I thought) it should: template <class S> class A{ //etc... A( const A & old ){ //do stuff... } //etc... }; template <class T> class B{ //etc... A<T> ReturnsAnA(){ A<T> result; // do some stuff with result return result; //line 108 } //etc... }; Any hints? I've banged my head against the wall about this for 4 hours now, and can't seem to come up with what's happening here.

    Read the article

  • Restlet vs Spring MVC for Restful web service

    - by zachariahyoung
    I'm researching how best to create a Restful web service on Google app engine. My end goal is to have an Android application call a web service on GAE to post and get data. At this point I not sure what the best approach is. What I know at this point is Spring MVC 3 provide the ability to create web service but it does not provide a full implementation of JAX-RS. I also have read a few blog that talk about how Spring and Restlet can be integrated together. On the other side I have read that I could only use Restlet in GAE. I would also like provide a light web interface for users to view their posted data So my questions are the following. 1. Should I just use Restlet. 2. Should I just use Spring MVC to provide my Restful web service. 3. Should I use Spring and Restlet together. At this point I think I should invest my time in Restlet because that seems to be the best approach for calling web services in Android. I'm also debating if Spring MVC is just over kill. Any thoughts would be helpful.

    Read the article

  • jQuery code working in Safari and Chrome but not Firefox

    - by Chris Armstrong
    I'm got a site that has a long list of tweets, and as you scroll down the right column follows you down, showing stats on the tweets. (See it in action at http://www.grapevinegame.com . Click 'memorise', then 'skip' to get to the list page. Works in Safari and Chrome). I'm using jQuery to update the top-margin of the right column, increasing it as I scroll down. It seems to be working fine in webkit-based browsers, but doesn't budge in Firefox. Heres the code, the right column element is a div with id = "distance". // Listen for scroll function $(window).scroll(function () { // Calculating the position of the scrollbar var doc = $("body"), scrollPosition = $("body").scrollTop(), pageSize = $("body").height(), windowSize = $(window).height(), fullScroll = (pageSize) - windowSize; percentageScrolled = (scrollPosition / fullScroll); var entries = $("#whispers-list > li").length; // Set position of distance counter $('div#distance').css('margin-top', ($("#whispers-list").height()+$("#latest-whisper").height()+33)*percentageScrolled); // Update distance counter $('#distance-travelled').text(Math.round(distanceTravelled*(1-percentageScrolled))); $('#whispers-list li').each(function(index) { //highlight adjacent whispers if ($('#whispers-list li:nth-child('+(index+1)+')').offset().top >= $('#distance').offset().top && $('#whispers-list li:nth-child('+(index+1)+')').offset().top <= $('#distance').offset().top + $('#distance').height()) { // alert("yup"); $('#whispers-list li:nth-child('+(index+1)+') ul').fadeTo(1, 1); } else { $('#whispers-list li:nth-child('+(index+1)+') ul').fadeTo(1, 0.5); } }); }); Appreciate any help or advice!

    Read the article

  • cannot load JSTL taglib within embedded Jetty server

    - by fthompson
    I am writing a web application that runs within an embedded Jetty instance. When I attempt to execute a JSTL statement, I receive the following exception: org.apache.jasper.JasperException: /index.jsp(1,63) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application I have the following jars on the classpath ant-1.6.5.jar ant-1.7.1.jar ant-launcher-1.7.1.jar core-3.1.1.jar jetty-6.1.22.jar jetty-util-6.1.22.jar jsp-2.1-6.1.14.jar jsp-api-2.1.jar jstl-1.2.jar servlet-api-2.5-20081211.jar servlet-api-2.5-6.1.14.jar standard-1.1.2.jar My web.xml looks like this: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee h77p://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>test</display-name> </web-app> My code looks like this: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <body> <h2>Hello World!</h2> <%= new java.util.Date() %><br/> ${1+2}<br/> <c:out var="${5+9}"/><br/> </body> </html> I started my embedded Jetty server like this: Server server = new Server(80); WebAppContext context = new WebAppContext("pig-1.0-SNAPSHOT.war","/"); server.addHandler(context); server.start(); I spent the past two days experimenting with various combinations of jar files, web.xml configurations, and tag library declarations, but to no avail. How can I get an embedded Jetty server up and running with full JSTL support?

    Read the article

  • Actionscript/Flex - Is it possible to dynamically extend an object, modify functions, add functions

    - by RR
    I know this question might be frowned upon, but actionscript is a dynamic language similar to javascript and in javascript I can take an object from a library written by someone else and dynamically (at runtime) add/remove/modify functions, properties, prototypes etc. this is kind of like dynamically extending an object to make it work with the library it came with as well as another library. Is something like this possible in flex actionscript? I'm thinking it is only possible with classes that are declared 'dynamic' and definitely not possible with classes declared 'final'. What are your thoughts? Any ideas/tricks?

    Read the article

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