Search Results

Search found 46009 results on 1841 pages for 'first timer'.

Page 8/1841 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Silverlight Timer problem

    - by jose
    Hello, I am developing a Silverlight application with custom animations. I want to update the variable animationCounter every 1 milissecond, so that in one second the value is 1000. I've tried DispatcherTimer and System.Threading.Timer. this way: DispatcherTimer timer = new DispatcherTimer(); (...) timer.Interval = new TimeSpan(0, 0, 0, 0, 1); timer.Tick += new EventHandler(timer_Tick); (...) (...) void timer_Tick(object sender, EventArgs e) { animationCounter++; Dispatcher.BeginInvoke(() => txtAnimationCounter.Text = animationCounter.ToString()); } with System.Threading.Timer System.Threading timer = null; timer = new System.Threading.Timer(UpdateAnimationCounter, 0, 1); void UpdateAnimationCounter(object state) { animationCounter++; Dispatcher.BeginInvoke(() => txtAnimationCounter.Text = animationCounter.ToString()); } Both of them are setting AnimationCounter around 100 in one second. Should be 1000. I don't know why. Is there anything I'm missing. Thanks

    Read the article

  • How do I have to take into account the direction in which the camera is facing when creating a first person strafe (left/right) movement

    - by Chris
    This is the code I am currently using, and it works great, except for the strafe always causes the camera to move along the X axis which is not relative to the direction in which the camera is actually facing. As you can see currently only the x location is updated: [delta * -1, 0, 0] How should I take into account the direction in which the camera is facing (I have the camera's target x,y,z) when creating a first person strafe (left/right) movement? case 'a': var eyeOriginal = g_eye; var targetOriginal = g_target; var viewEye = g_math.subVector(g_eye, g_target); var viewTarget = g_math.subVector(g_target, g_eye); viewEye = g_math.addVector([delta * -1, 0, 0], viewEye); viewTarget = g_math.addVector([delta * -1, 0, 0], viewTarget); g_eye = g_math.addVector(viewEye, targetOriginal); g_target = g_math.addVector(viewTarget, eyeOriginal); break; case 'd': var eyeOriginal = g_eye; var targetOriginal = g_target; var viewEye = g_math.subVector(g_eye, g_target); var viewTarget = g_math.subVector(g_target, g_eye); viewEye = g_math.addVector([delta, 0, 0], viewEye); viewTarget = g_math.addVector([delta, 0, 0], viewTarget); g_eye = g_math.addVector(viewEye, targetOriginal); g_target = g_math.addVector(viewTarget, eyeOriginal); break;

    Read the article

  • How to change eclipse plugin's default parent-first classloader policy to child-first classloader po

    - by deepthinker121
    Hi All, I want to change the behavior of eclipse's parent-first classloader policy to child-first classloader policy. The scenario would be : Plugin A has class C in dependent external jar. When the classloader of the jar looks for "META-INF" folder - it should find the META-INF folder of the jar and not the one found by its parent classloader - that is the plugin A's META-INF folder. So I want to change the classloader policy to 'child-first' rather than 'parent-first' Is it possible to do this by changing the plugin A's Manifest or plugin.xml?

    Read the article

  • Timer C#. Start, stop, and get the amount of time between the calls

    - by user1886060
    I'm writing UDP chat with reliable data transfer. I need to start a timer when a packet is sent, and stop it as soon it receives an answer from the server(ACK- acknowledgment). Here is my code: private void sendButton_Click(object sender, EventArgs e) { Packet snd = new Packet(ack, textBox1.Text.Trim()); textBox1.Text = string.Empty; Smsg = snd.GetDataStream();//convert message into array of bytes to send. while (true) { try { // Here I need to Start a timer! clientSock.SendTo(Smsg, servEP); clientSock.ReceiveFrom(Rmsg, ref servEP); //Here I need to stop a timer and get elapsed amount of time. Packet rcv = new Packet(Rmsg); if (Rmsg != null && rcv.ACK01 != ack) continue; if (Rmsg != null && rcv.ACK01 == ack) { this.displayMessageDelegate("ack is received :"+ack); ChangeAck(ack); break; } Thank you.

    Read the article

  • Configuration Data in a Custom Timer job in Sharepoint 2010 : The Hierarchical Object Store

    - by Gino Abraham
    I was planning for a custom timer job for which i wanted to store some configuration data. Was looking for some best practices, found a useful links on The Hierarchical Object store Store http://www.chaholl.com/archive/2011/01/30/the-skinny-on-sppersistedobject-and-the-hierarchical-object-store-in.aspxInitially was planning for a custom list, but this would make us run a cross site query and the list name and the url should again be kept in some configuration which is an headache to maintain. Hierarchical object store was zeroed in and thanks to google for the same :)

    Read the article

  • Multiple dynamic timers

    - by Rickard
    I am working on a project where I need to let the user create one (or more) timers to fire off an event. The user is supposed to define variables such as if the timer should be active and how often the timer will fire along with some other variables of what will happen when the timer is fiering. All these variables are stored in a dictionary (Disctionary) where the object holds all the variables the user has set and the string is the name that the user has chosen for this timer. I then want my program to loop through this dictionary and search for all objects which has the variable t_Active set to true (this I have already achieved). What I need help with figuring out is the follwoing: When it detects the variable, and if it's set to true, I need the program to see if there is already a timer created for this. If it isn't, it should create one and set the relevant parameters for the timer. The two variables t_num and t_period should decide the interval of the timer. t_num is an int and t_period is a string which will be set to either minutes, hours or days. Combining t_num with 60000 (minutes), 3600000 (hours) or 86400000 should give the corrct interval. But how would I go on about programatically create a timer for each user-defined active object? And how do I get the program to detect wether or not a timer has already been created? I have been searching both here and on google, but so far I haven't come across something that makes sense to me. I am still learning C#, so what make sense to you guys may not neccessarilly make sense to me yet. :) I hope I have explaned what I need good enough, please do ask me to clarify if you don't get me. Edit: Maybe I should also mention that the mentioned dictionary will also be saved to an XML file to that the user can pick up all the settings they made at any time.

    Read the article

  • Is ACE reactor timer managment thread safe?

    - by idimba
    I have a module that manages timers in my aplication. This class has basibly three functions: Instance of ACE_Reactor is used internally by the module to manage the timers. schedule timer - calls ACE_Reactor::schedule_timer(). One of the arguments is a callback, called upon timer experation. cancel timer - calls ACE_Reactor::cancel_timer() The reactor executed in private timer of execution, so schedule/cancel and timeout callback are executed in different threads. ACE_Reactor::schedule_timer() receives a heap allocatec structure ( arg argument). This structure later deleted when canceling timer or when timeout handler is called. But since cancel and timeout handler are executed in different threads it looks like there's cases that the structure is deleted twice. Isn't it responsibility of reactor to ensure that timer is canceled when timeout handler is called?

    Read the article

  • Telling a UITextField to become first responder while embedded in a UITableViewCell

    - by Jasarien
    I have a UITextField that is a subview of a UITableViewCell. When my view loads, I want the text field to become first responder. I have a pointer to the text field in the table cell, so to do this I am trying: [myTextField becomeFirstResponder]; This returns NO all the time, regardless of when it's called, which according to the docs means the text field refused to become first responder... What am I doing wrong? Edit: The text field properly responds to being touched. It bring up the keyboard then. It's only when telling it to become first responder programmatically that the problem happens.

    Read the article

  • MVVM View-First Approach How Change View

    - by CodeWeasel
    Hi everybody, Does anybody have an idea how to change screens (views) in a MVVM View-First-Approach (The view instantiates the ViewModel: DataContext="{Binding Source={StaticResource VMLocator}, Path=Find[EntranceViewModel]}" ) For example: In my MainWindow (Shell) I show a entrance view with a Button "GoToBeach". <Window> <DockPanel> <TextBox DockPanel.Dock="Top" Text="{Binding Title}" /> <view.EntranceView DockPanel.Dock="Top" /> </DockPanel> </Window> When the button is clicked I want to get rid of the "EntranceView" and show the "BeachView". I am really curious if somebody knows a way to keep the View-First Approach and change the screen (view) to the "BeachView". I know there are several ways to implement it in a ViewModel-First Approach, but that is not the question. Perhabs I missed something in my mvvm investigation and can't see the wood for the trees... otherwise i am hoping for a inspiring discussion.

    Read the article

  • mysql first record retrieval

    - by Sammy
    While very easy to do in Perl or PHP, I cannot figure how to use mysql only to extract the first unique occurence of a record. For example, given the following table: Name Date Time Sale John 2010-09-12 10:22:22 500 Bill 2010-08-12 09:22:37 2000 John 2010-09-13 10:22:22 500 Sue 2010-09-01 09:07:21 1000 Bill 2010-07-25 11:23:23 2000 Sue 2010-06-24 13:23:45 1000 I would like to extract the first record for each individual in asc time order. After sorting the table is ascending time order, I need to extract the first unique record by name. So the output would be : Name Date Time Sale John 2010-09-12 10:22:22 500 Bill 2010-07-25 11:23:23 2000 Sue 2010-06-24 13:23:45 1000 Is this doable in an easy fashion with mySQL? Thanks, Sammy

    Read the article

  • iPhone first time application ran and config files

    - by VansFannel
    Hello. I have two question: I'm developing an iPhone application and I want to know when it is the first time the application is executed. I want to check some extended permissions from facebook the first time. How can I know that? (first question) Another way to solved this problem is to store the extended permissions granted in some configuration file. I don't want to make visible this file through app settings icon. How can I add some configuration files to store these permissions granted? (second question) Thanks

    Read the article

  • Problem re-factoring multiple timer countdown

    - by Joko Wandiro
    I create my multiple timer countdown from easy or simple script. entire code The problem's happen when i want to add timer countdown again i have to declare variable current_total_second CODE: elapsed_seconds= tampilkan("#time1"); and variable timer who set with setInterval.. timer= setInterval(function() { if (elapsed_seconds != 0){ elapsed_seconds = elapsed_seconds - 1; $('#time1').text(get_elapsed_time_string(elapsed_seconds)) }else{ $('#time1').parent().slideUp('slow', function(){ $(this).find('.post').text("Post has been deleted"); }) $('#time1').parent().slideDown('slow'); clearInterval(timer); } }, 1000); i've already know about re-factoring and try different way but i'm stack to re-factoring this code i want implement flexibelity to it.. when i add more of timer countdown.. script do it automatically or dynamically without i have to add a bunch of code.. and the code become clear and more efficient. Thanks in Advance

    Read the article

  • Generate money type fields using code first EF CTP5

    - by BBHorus
    In this blog post: EF4 Code First Control Unicode and Decimal Precision, Scale with Attributes, Dane Morgridge used attributes to control the creation of different types on your database. ...And I found this pretty unique BTW!!! How do I generate money type fields in my resulting database using code first API of EF CTP5, if is possible to do it from your model, using conventions or attributes? Sorry about my English is not my main language. Thanks in advance.

    Read the article

  • VBA Macro On Timer style to run code every set number of seconds, i.e. 120 seconds

    - by FinancialRadDeveloper
    I have a need to run a piece of code every 120 seconds. I am looking for an easy way to do this in VBA. I know that it would be possible to get the timer value from the Auto_Open event to prevent having to use a magic number, but I can't quite get how to fire off a timer to get something to run every 120 seconds. I don't really want to use an infinite loop with a sleep if I can avoid it. EDIT: Cross-post based on an answer provided is at: http://stackoverflow.com/questions/2341762/excel-vba-application-ontime-i-think-its-a-bad-idea-to-use-this-thoughts-eit

    Read the article

  • How do I reset a countdown timer when it reaches 0? (Xcode 4)

    - by Zac Prunty
    first question and I have researched the heck out of this and can't seem to find any answers. I would like to implement a countdown timer in my app that starts at 30 seconds and resets when it hits 0. It will count back by 1 second intervals. I have played around with the resources that Apple provides and I can't seem to implement the NStimer to do as I just explained. Are there any suggestions on how I could code this? I would eventually like to link this to a button that will start the timer when it is pressed. I appreciate any advice on this topic!

    Read the article

  • :first-child fails when an element of a different class is dynamically inserted above

    - by koko
    So, I've encountered a situation where inserting an element of a different class/id breaks all css-rules on that :first-child. <div id="nav"> <div class="nSub">abcdef</div> <div class="nSub">abcdef</div> <div class="nSub">abcdef</div> <div class="nSub">abcdef</div> <div class="nSub">abcdef</div> </div> .nSub:first-child { margin-top:15px; -moz-border-radius-topleft:5px; /* ... */ } .nSub { background:#666; /* ... */ } .nSub:last-child { -moz-border-radius-bottomleft:5px; /* ... */ } As soon as I insert an element of another class/id above, like this: $('nav').insert({top:'<div id="newWF"></div>'}); all declarations for .nSub:first-child are being ignored in both FF 3.6 and Safari 4.

    Read the article

  • Executing logic before save or validation with EF Code-First Models

    - by Ryan Norbauer
    I'm still getting accustomed to EF Code First, having spent years working with the Ruby ORM, ActiveRecord. ActiveRecord used to have all sorts of callbacks like before_validation and before_save, where it was possible to modify the object before it would be sent off to the data layer. I am wondering if there is an equivalent technique in EF Code First object modeling. I know how to set object members at the time of instantiation, of course, (to set default values and so forth) but sometimes you need to intervene at different moments in the object lifecycle. To use a slightly contrived example, say I have a join table linking Authors and Plays, represented with a corresponding Authoring object: public class Authoring { public int ID { get; set; } [Required] public int Position { get; set; } [Required] public virtual Play Play { get; set; } [Required] public virtual Author Author { get; set; } } where Position represents a zero-indexed ordering of the Authors associated to a given Play. (You might have a single "South Pacific" Play with two authors: a "Rodgers" author with a Position 0 and a "Hammerstein" author with a Position 1.) Let's say I wanted to create a method that, before saving away an Authoring record, it checked to see if there were any existing authors for the Play to which it was associated. If no, it set the Position to 0. If yes, it would find set the Position of the highest value associated with that Play and increment by one. Where would I implement such logic within an EF code first model layer? And, in other cases, what if I wanted to massage data in code before it is checked for validation errors? Basically, I'm looking for an equivalent to the Rails lifecycle hooks mentioned above, or some way to fake it at least. :)

    Read the article

  • WSDL first for existing service layer

    - by Jurgen H
    I am working on an existing Java project with a typical services - dao setup for which only a webapplication was available. My job is to add webservices on top of the services layer, but the webservices have their own functional analysis and datamodel. The functional analyses ofcource focuses on what is possible in the different service methods. As good practice demands, we used the WSDL first strategy and generated JAXB bound Java classes and a SEI for the webservices. After having implemented the webservices partially, we noticed a 70% match between the datamodel. This resulted in writing converters which take the webservice JAXB classes and map them with the service layer classes. Customer customer = new Customer(); customer.setName(wsCustomer.getName()); customer.setFirstName(wsCustomer.getFirstName(); .. This is a very obvious example, some other mappings where little more complicated. Can anyone give his best practices, experiences, solutions to this kind of situations? Are any of these frameworks usefull? http://transmorph.sourceforge.net/wiki/index.php/Main_Page http://ezmorph.sourceforge.net/ Please don't start a discussion about WSDL first vs code first.

    Read the article

  • Timer appears to be pausing when screen becomes inactive

    - by elchuppa
    So I have a very simple android activity that starts a timer when you hit a button. Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { doStuff(); } }, 15 * 60 * 1000); So this worked reasonably well for me when I was testing but as it turns out when the screen becomes inactive so does the timer. I was a bit surprised by this. I understand you need to create a service to have anything running in the background but I hadn't realized this is required for an activity in the foreground when the phone has inactivated the screen due to lack of activity. What confuses me is I think this worked as I expected originally and just in the last few weeks or so has the timer been affected by the phone saving power. I could be wrong though.. So basically my questions are: am I seeing expected behavior? Do I need to create all timers as services or somehow disallow powersaving? thanks for any advice, Patrick

    Read the article

  • Exclude first child with XSL-T

    - by zneak
    Hello, What I'm trying to do is fairly simple, but I can't find the way to. I just want to iterate over the children of a node excluding the first child. For instance, in this XML snippet, I would want all the <bar> elements, except the first one: <foo> <Bar>Example</Bar> <Bar>This is an example</Bar> <Bar>Another example</Bar> <Bar>Bar</Bar> </foo> There is no common attribute by which I can filter (like an id tag or something similar). Any suggestions?

    Read the article

  • Simple reminder for Android

    - by anta40
    I'm trying to make a simple timer. package com.anta40.reminder; import java.util.Timer; import java.util.TimerTask; import android.app.Activity; import android.os.Bundle; import android.widget.RadioGroup; import android.widget.TabHost; import android.widget.TextView; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.TabHost.TabSpec; public class Reminder extends Activity{ public final int TIMER_DELAY = 1000; public final int TIMER_ONE_MINUTE = 60000; public final int TIMER_ONE_SECOND = 1000; Timer timer; TimerTask task; TextView tv; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); timer = new Timer(); task = new TimerTask() { @Override public void run() { tv = (TextView) findViewById(R.id.textview1); tv.setText("BOOM!!!!"); tv.setVisibility(TextView.VISIBLE); try { this.wait(TIMER_DELAY); } catch (InterruptedException e){ } tv.setVisibility(TextView.INVISIBLE); } }; TabHost tabs=(TabHost)findViewById(R.id.tabhost); tabs.setup(); TabSpec spec = tabs.newTabSpec("tag1"); spec.setContent(R.id.tab1); spec.setIndicator("Clock"); tabs.addTab(spec); spec=tabs.newTabSpec("tag2"); spec.setContent(R.id.tab2); spec.setIndicator("Settings"); tabs.addTab(spec); tabs.setCurrentTab(0); RadioGroup rgroup = (RadioGroup) findViewById(R.id.rgroup); rgroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.om){ timer.schedule(task, TIMER_DELAY, 3*TIMER_ONE_SECOND); } else if (checkedId == R.id.twm){ timer.schedule(task, TIMER_DELAY, 6*TIMER_ONE_SECOND); } else if (checkedId == R.id.thm){ timer.schedule(task, TIMER_DELAY, 9*TIMER_ONE_SECOND); } } }); } } Each time I click a radio button, the timer should start, right? But why it doesn't start?

    Read the article

  • Data not displayed first time in android after copying the file from assets to data folder

    - by Thinkcomplete
    Description I have used the code tip from http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ to copy a pre-filled data file to the target and handled this in a asynch task Problem : On starting the application it gives error and shuts down first time, starting again without any change it works perfectly fine. So first time after the file is copied, the error comes but after that no issues. Please help Code attached:.. private class CopyDatabase extends AsyncTask<String, Void, Boolean> { private final ProgressDialog dialog = new ProgressDialog(BabyNames.this); protected void onPreExecute() { this.dialog.setMessage("Loading..."); this.dialog.show(); } @Override protected Boolean doInBackground(String... params) { // TODO Auto-generated method stub try { namesDBSQLHelper.createDatabase(); return null; } catch(IOException ioe){ ioe.printStackTrace(); } return null; } protected void onPostExecute(final Boolean success){ if (this.dialog.isShowing()){ this.dialog.dismiss(); } } }

    Read the article

  • touchesEnded:withEvent: from UIScrollView First Responder

    - by Matthew Mitchell
    I've made a UIScrollView the first responder. I need to maintain touch events to a touchesEnded:withEvent: method on a view behind it. I've tried using the nextResponder method and that failed. I've tried forwarding touchesEnded:withEvent to the view behind it and that fails. How do I get this to work? The UIScrollView wont work unless it is the first responder or gets events some other way. Thank you for any help. Shame Apple's documentation and APIs are terrible in areas.

    Read the article

  • EF4 Code First - Many to many relationship issue

    - by Yngve B. Nilsen
    Hi! I'm having some trouble with my EF Code First model when saving a relation to a many to many relationship. My Models: public class Event { public int Id { get; set; } public string Name { get; set; } public virtual ICollection<Tag> Tags { get; set; } } public class Tag { public int Id { get; set; } public string Name { get; set; } public virtual ICollection<Event> Events { get; set; } } In my controller, I map one or many TagViewModels into type of Tag, and send it down to my servicelayer for persistence. At this time by inspecting the entities the Tag has both Id and Name (The Id is a hidden field, and the name is a textbox in my view) The problem occurs when I now try to add the Tag to the Event. Let's take the following scenario: The Event is already in my database, and let's say it already has the related tags C#, ASP.NET If I now send the following list of tags to the servicelayer: ID Name 1 C# 2 ASP.NET 3 EF4 and add them by first fetching the Event from the DB, so that I have an actual Event from my DbContext, then I simply do myEvent.Tags.Add to add the tags.. Problem is that after SaveChanges() my DB now contains this set of tags: ID Name 1 C# 2 ASP.NET 3 EF4 4 C# 5 ASP.NET This, even though my Tags that I save has it's ID set when I save it (although I didn't fetch it from the DB)

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >