w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Milliseconds timer matlab
Assuming the function you have is fast enough (not a trivial assumption) you can achieve it like so: tic for t = 0.01:0.01:1 %If you want the first function call to start right away you can change this to 0:0.01:0.99 while toc < t end t %Put your function call here. end Note that 0.01 sec is 10 ms

Categories : Matlab

using timer in MATLAB to extract the system time
I'd do a couple of things here. First, you probably don't really need to pass the h, m, s inputs, if you are displaying current time. Add this to the top of your function to auto set these variables. if nargin == 0 [~,~,~,h,m,s] = datevec(now); end Then, it is pretty easy to use a time to call this function periodically. Something like this. t = timer; t.ExecutionMode = 'FixedSpacing'; %Use one of the repeating modes t.Period = 1; %Fire on 1 second intervals t.TimerFcn = @(~,~)raviClock; %When fired, call this function (ignoring 2 inputs) start(t); %GO! Use docsearch timer for in depth documentation of the timer objects. But the code above should get you started. To stop the timer, run stop(t); To stop the timer when the

Categories : Matlab

Ignoring [Django] ERROR (EXTERNAL IP): Internal Server Error
In your LOGGING configuration you can override handler class 'handlers': { 'mail_admins': { 'level': 'ERROR', 'class': 'django.utils.log.MyAdminEmailHandler', 'include_html': True, } }, Now you can write your class MyAdminEmailHandler. Check its code in AdminEmailHandler In emit function, just get rid of report if (request.META.get('REMOTE_ADDR') not in settings.INTERNAL_IPS)

Categories : Python

How to aggregate in R ignoring some rows for some fields, and not ignoring them for others?
Use aggregate, with both the arguments na.action=na.pass and na.rm=TRUE. The former tells aggregate not to remove rows where NAs are present; and the latter is the action that the aggregating function should take. aggregate(cbind(qA, qB, qC) ~ city, df, mean, na.action=na.pass, na.rm=TRUE)

Categories : R

Standard error ignoring NaN in pandas groupby groups
count() method of Series object will return no NaN value count: import pandas as pd s = pd.Series([1,2,np.nan, 3]) print s.count() output: 3 So, try: ci = grouped.aggregate(lambda x: np.std(x) / x.count() * 1.96)

Categories : Python

compile android app in eclipse ignoring java error
There is no (public) Intent.FLAG_FLOATING_WINDOW constant, according to the sdk documentation, hence the compile error. Presumably, it's specific to the custom rom your attempting to build for? You cannot just bypass a compile error like this. However, since we're talking about a constant, you may be able to substitute the reference with the actual value. All the flag constants defined by the Intent class are simply ints, but you'd have to know the value in order to be able to replace it. You should be able to find that somewhere in the custom rom's source that you're referring to. For example, suppose the contant would have the following definition: public static final int FLAG_FLOATING_WINDOW = 1234; Then a valid addFlags() call using this value would look like this: addFlags(1234)

Categories : Android

Git SVN Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item
You really can't do it that way. git svn requires that you have a linear history (ok, git doesn't; svn itself does). So all of your git work must end up on the end of the commit-tree for svn. The right thing to do is use git svn clone first to mirror the remote repository and then make commits to that checked out version and run git dcommit. Yes, there are other ways to do this, but the way you are doing it above makes a commit before pulling in the remote content, which won't work. If you're just trying to add all your existing changes to the version from the remote, you can probably do it this way: # git init # git checkout -b "mychanges" # git checkout master # git svn init .... # git svn fetch # git checkout mychanges # git rebase master # git checkout master # git merge --ff-onl

Categories : Misc

Ignoring an error message from yum command [when package is already installed] - bash
Try to redirect output to grep and filter the message: yum -y -q install something 2>&1 | grep -v "already installed and latest version" Or just completely redirect all messages to /dev/null: yum -y -q install something >/dev/null 2>&1

Categories : Linux

Timer/TimerTask Error
I guess you are updating ui from the backgroudn thread. Timer runs on a different thread. You should update ui on the ui thread. Use runOnUiThread runOnUiThread(new Runnable() { @Override public void run() { // update ui here. } }); android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. The above generally means you are updaint/acessing ui from another thread. You can also use a Handler Handler m_handler; Runnable m_handlerTask ; m_handler = new Handler(); m_handlerTask = new Runnable() { @Override public void run() { // do something m_handler.postDelayed(m_handlerTask, 1000);

Categories : Android

System.Timers.Timer Elapsed event executing after timer.Stop() is called
This is well known behavior. System.Timers.Timer internally uses ThreadPool for execution. Runtime will queue the Timer in threadpool. It would have already queued before you have called Stop method. It will fire at the elapsed time. To avoid this happening set Timer.AutoReset to false and start the timer back in the elapsed handler if you need one. Setting AutoReset false makes timer to fire only once, so in order to get timer fired on interval manually start timer again. yourTimer.AutoReset = false; private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { // add your logic here } finally { yourTimer.Enabled = true;// or yourTimer.Start(); } }

Categories : C#

creating a jquery timer: timer won't continue counting after manual edit
This is not very obvious but the issue is with the use of timeSec.attr("value", timeSecNum + 1) instead of using timeSec.val(timeSecNum + 1) See this question for a good explanation (assigning attributes vs. properties)

Categories : Jquery

Use 'javax.swing.Timer' and 'java.util.Timer' in the same project?
Yes, you can but if you are using both in the same java file, you will need to access one of the class by the full package name like java.util.Timer because it will get a conflict if you import both of the classes.

Categories : Java

Is Timer accurate enough to not send TimerEvent.TIMER event after delay?
No, it is not exact. Time slicing is a surprisingly complex process. Here's a few resources: http://www.bit-101.com/blog/?p=910 http://www.craftymind.com/tag/elastic-racetrack/ What it all comes down to in a nut shell, is that the AVM tries to juggle between executing system code, user code and frame rendering as fast as possible, but needs to decide on what process gets which priority (and subsequent processing time) and it's these decisions that will influence timer accuracy. I.e sometimes accurate, sometimes not. Basically, the more you throw at it, the less accurate it gets.

Categories : Actionscript

How do I tell that timer in " timer.stop(); " inside onBackPressed() is the same local variable I used before?
Thread.stop() is deprecated and you should not use that. A better Splashscreen implementation would be using Handler-Runnable something like the below. private Handler handler = new Handler(); private Runnable runnable = new Runnable() { public void run(){ Intent openHome = new Intent(Splash.this, main.class); startActivity(openHome); finish(); } } public void onCreate(Bundle b) { super.onCreate(b); handler.postDelayed(runnable, 4400); } public void onBackPressed(){ handler.removeCallbacks(runnable); super.onBackPressed(); }

Categories : Javascript

passing timer through dependency injection and configuring / starting a timer
If your question is, that you want to dependency inject a timer that you can later bind an event to, it should be simple. Just create your Timer class to follow an ITimer interface and create methods on it to do the actions you want. public class Calendar { public Calendar(ITimer timer) { // timer is the dependency injected timer timer.SetEvent(EventReminder, 3600); } public void EventReminder() { Console.Write("Hey, it's time for your appointment!"); } } public interface ITimer { void SetEvent(Action callbackMethod, int interval); } In this case, you have a calendar application, and you want your application to have a timer. But you don't care how the timer works, or even what kind of timer (maybe you want a timer that works on mi

Categories : C#

I dont understand how to make a timer like apple's countdown timer
You need to keep track of what time was on the timer when you hit back and save it somehow. You can save it through NSUserDefaults which would be the easiest, but since you could have multiple timers it might be cleaner to do a simple CoreData app. The logic (if I understand your problem correctly): 1. User pushes to DetailView and timer starts 2. User wants to pop back 2.1 Save the date the timer started to the task record 3. User wants to go back to same task 3.1 Load the NSDate of when the timer started from disk 3.2 Calculate the offset from then until now 3.3 Add that to the clock 3.4 Start the timer with the offset added Hope that helps.

Categories : Iphone

Timer kills task/job if it runs longer than timer interval
t.Interval = intervalMiliseconds; That's indeed the troublemaker. It is pretty unintuitive behavior, one that the MSDN article for Timer.Interval specifically warns about in a Note: If Enabled and AutoReset are both set to false, and the timer has previously been enabled, setting the Interval property causes the Elapsed event to be raised once, as if the Enabled property had been set to true. To set the interval without raising the event, you can temporarily set the AutoReset property to true. It's a fairly silly hack but does work. Just delaying assigning the value is certainly the better way to do it. Doing it early doesn't buy you anything, other than trouble, the timer isn't going tick anyway since you've got AutoReset = false. System.Threading.Timer is the better time

Categories : C#

Error handling for timer functions
You should probably use the ErrorFcn property of the timer object. A simple example: >> tcallback = @(~, ~) error('Oops.'); >> ecallback = @(~, ~) disp('Caught error'); >> t = timer('TimerFcn', tcallback, 'ErrorFcn', ecallback); >> start(t) Error while evaluating TimerFcn for timer 'timer-2' Oops. Caught error You can obviously make your error handling more robust than that, but it takes care of the asynchronous nature of timer errors. The input arguments to the ErrorFcn (if you don't suppress them as in the above example) provide information about the error that was thrown, so you can handle them specifically.

Categories : Matlab

Python, threading.timer object will not run function timer?
Not sure if this is what you're looking for, but if your problem is that the timer thread is ran independently of the main script, you can join that thread like so: t.start() t.join() # will wait until the thread `t` has finished But this kind of defeats the purpose of running your function in a separate thread. So you might want to just time.sleep for some time before or after sending out that e-mail. By the way, make sure that a call to send_email('Tank temperature Overheat',tank_temp) actually returns a function that will be called when the timer thread is started and doesn't send the actual mail.

Categories : Python

How to set a timer like event handler and stop the timer on a condition
The thing I want to do is that I want to do some things AFTER these elements are loaded. In this situation it sounds like you should pass a callback to the function loading the content, which should be executed after the load. If you do decide you want to follow the logic you've mapped out, this should work: var timer = setInterval(function() { if ($(".elementthatmustappear").is(":visible")) { clearInterval(timer); doSomethingElse() } }, 1000);

Categories : Jquery

What is the difference between Timer.Start and Timer.Enabled = True in vb.net?
They both do the same thing. According to MSDN Start Method Starts raising the Elapsed event by setting Enabled to true.

Categories : Vb.Net

Precise timer with event similar to Timer.Tick
Use elapsed time since some moment. Than either: Pick any timer, set it for 15ms and display elapsed time on each tick (should be ok if you are dealing with WinForm/WPF controls) On every frame refresh display new value (if your code get notified/invoked on every frame refresh)

Categories : C#

Waiting until a timer runs out and executing another timer
I would suggset working with Tasks. you set up a task to do something (it can just wait for X seconds, than it is a timer) than you set continueWith to assign a new task to run when the first one is finshed. You can read more about this here: http://msdn.microsoft.com/en-us/library/dd537612.aspx And by the way, you really should not run heavy calculations on the UI thread itself. If you decide to use tasks - that would be fine. Otherwise , you need to create background thread and do the work there. Edit: After some clarification from the OP , I will try to explain the basics or working with UI and background threads: When you run a winforms/WPF application, all of the user interface events are handled in a single thread - the UI thread. it goes over all of the events and processes them

Categories : C#

Can EJB timer invocations overlap for a specified timer according to specification?
The short answer is that I don't think this is specified. The long answer is that I was sure this was specified until I looked through the EJB 3.2 spec and the javax.ejb API doc, and I couldn't find anything that said definitively. The spec is clear that if a single timeout fails that it must retry at least once (which would create a weird scenario where an "old" timeout is retrying after a "new" timeout has succeeded) and that if the container/application is down when a timer should have fired that it needs to fire at least one "catch up", but I couldn't find anything that talked about overlapping timeout methods. I don't know what JBoss does, but for others that find this answer, I do know that WebSphere Application Server implements timeout callbacks for a single Timer in a "serial"

Categories : Java

How Multiple keypress in Timer or timer altnernative?
Your current code if (Form.ModifierKeys == System.Windows.Forms.Keys.Control && Form.ModifierKeys == System.Windows.Forms.Keys.Enter) means "if the keys pressed equals the control key AND the keys pressed equals the enter key". This will never happen, because if only the control key is pressed, the enter key is not pressed, and vise versa. I believe you wanted this: if (Form.ModifierKeys.HasFlag(Keys.Control) && Form.ModifierKeys.HasFlag(Keys.Enter)) This means "if the keys pressed includes the control key and the enter key". You shouldn't use timers for this anyways. Look into the Control.KeyPress event and use that instead. You can use the timer to load the text file while using events to handle the key press. I suggest you read more about the KeyPress

Categories : C#

Can you create a timer without the Timer component
Yes. You can use a System.Timers.Timer (or a System.Threading.Timer), and create this manually in the code. The designer is not required to use these timers.

Categories : Vb.Net

Delete timer-queue timer
You are not creating your own queue (CreateTimerQueue) rather you are adding to the default timer queue which is not deletable, instead delete the timer itself (DeleteTimerQueueTimer). If you want to group multiple timers, create your own queue which you can then subsequently delete.

Categories : C++

Error using mesh, matlab
At a guess, get( handles.funkcja , 'string' ) is returning a string. You can test this by checking whether f(1,2) returns ans = x.^2+y.^2 It should return ans = 5 You could potentially fix this problem with f = @(x,y)( eval(get( handles.funkcja , 'string' )) );

Categories : Matlab

MATLAB Optimization Error
Interesting problem! Too bad it can't be solved deterministically. :-( Anyway, your TolFun is defined by the mathworks as being: Positive scalar. The algorithm stops if the weighted average relative change in the best fitness function value over StallGenLimit generations is less than or equal to TolFun and StallGenLimit has the same description. It makes perfect sense that a constant will give you the same error. It appears to me that the GA is unable to converge to a solution in the StallGenLimit, here 200, generations. You could try making the TolFun more restrictive, like 1e-12, or try and develop a far simpler model for the GA, one that will just allow you to find a solution. Then build complexity on this model until it matches your real system. Likely, it will fail a

Categories : Matlab

MATLAB Error:Out of Memory
Based on some assumptions I would reason that: - n_of_padding should be smaller than N_window - N_window is much smaller FS - Fs is not too high (frequency of your sound, so should not exceed a few thousand?!) - Your zeros matrix will not be huge This should mean that the problem is not that you are creating a too large matrix, but that you already filled up the memory before this call. How to deal with this? First type dbstop if error Run your code When it stops check all variable sizes to see where the space has gone. If you don't see anything strange (and the big storage is really needed) then you may be able to process your song in parts.

Categories : Matlab

Error handling in MATLAB
I am not too sure what you are asking, but I looked up the try/catch page on Matlab and it seems to be helpful. Try/catch helps you deal with errors. For instance, the example they gave about the combinations really highlights its usage. From what I see you are using try/catch appropriately, provided you have the vector a declared.

Categories : Matlab

Error when using function in MATLAB
Your function is returning f as the output of sprintf, which is a char array. You can't put this into x, because x has already been defined as containing doubles with x(1)=0.3; You may want to use sprintf to print the value to screen so you can check it, but your function should be returning a number, value. ETA: As Rody explained in the comments, format can be used to change how Matlab displays numbers, but the precision does not change. Similarly, sprintf can control the format but it doesn't change the value itself. Try these lines at the command line: format short value = 3.000000000012 format long value

Categories : Matlab

Error using minus in MATLAB
Are you sure, that all values are really initialised? Try to check this before your codeline. disp(pb(1,num).pos(i,1)) disp(pw(1,num).pos(i,1)) temp(i,1) = rand(1)*(pb(1,num).pos(i,1) - pw(1,num).pos(i,1));

Categories : Matlab

writeVideo error in MatLAB
Following up on Acoustic77's comment, it looks like you have your VideoWriter object as mov, but you're passing the string 'mov' instead of the object mov to writeVideo. % demo using random data and surface plot mov = VideoWriter('demo.avi'); mov.open; figure; for x = 1:10 data = rand(25,25); surf(data); renderer = get(gcf,'renderer'); if strcmp(renderer,'painters') renderer = 'opengl'; end frame = hardcopy(gcf, ['-d' renderer], ['-r' num2str(round(300))]); writeVideo(mov, frame); end mov.close; mov.delete;

Categories : Matlab

Error in MATLAB code
Well immediately, your error tells you what line your error is at. So you go to that line. It also tells you what function is causing the error - "times". You don't know what that is, so you look it up in the doc file. Turns out it's the .* operator. Your error tells you that "the matrix dimensions don't agree" - what does it mean? Matrix, dimensions, don't agree - your two variables are different sizes. song(length(song)+length(myFilter)-1) = 0; myFilter(length(song)+length(myFilter)-1) = 0; edges =ifft(fft(song).*fft(myFilter)); These lines are where your error is. You are increasing the length of song and then defining myFilter as longer than length of song, then trying to .* it (transformed) with song. Unless you tell fft/ifft how many points to use, you get the same size output as

Categories : Matlab

Python equivalent of Java Timer java.util.Timer
Yes, have a look at the sched module. It utilizes binary heap (from heapq) as well.

Categories : Java

Different behaviour of System.Timers.Timer and System.Threading.Timer
Timeout.Infinite is The time interval between invocations of callback, in milliseconds. Specify Timeout.Infinite to disable periodic signaling. See MSDN: http://msdn.microsoft.com/en-us/library/2x96zfy7.aspx Timeout.Infinite is a constant used to specify an infinite waiting period. Try this to get perodic calls to the callback new System.Threading.Timer(GameEndedCallback, game, (int)delay.TotalMilliseconds, (int)delay.TotalMilliseconds);

Categories : C#

Creating a Scheduler(Timer) inside run method of a Scheduler(Timer)
Why not just call ScheduledExecutorService.scheduleAtFixedRate or ScheduledExecutorService.scheduleWithFixedDelay? UPDATE This is one means of implementing what (I believe) you want: ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); void start(final Connection conn) { executor.scheduleWithFixedDelay(new Runnable(){ public void run(){ try { poll(conn); } catch (Exception e) { e.printStackTrace(); } } }, 0, 1, TimeUnit.HOURS); } private void poll(Connection conn) throws SQLException { final ResultSet results = conn.createStatement().executeQuery("SELECT song, playtime FROM schedule WHERE playtime > GETDATE() AND playtime < GETDATE() + 1 HOUR"); while (results.next()) { final String song = results.getString("song"); final Time time =

Categories : Java

ERROR SVMCLASSIFY MATLAB out of memery
The error means you do not have enough memory available on your machine to carry out the classification. Firstly, try repeating the commands with a freshly started MATLAB, without creating any more variables than necessary, and with no other applications running. If that doesn't work, then essentially you will need to either work with a smaller dataset, or get more memory for your machine.

Categories : Matlab

Matlab Saveas Error in 2013a
Here the code i used (i created the "time series 18 to 1000" folder), and it works on my computer (matlab r2010a): node = 1; Seg = 2; Lay = 3; RMSE = @(x) x*4; h=figure; plot(rand(1,5)); legend('W2 output') xlabel('JDAY') ylabel('T deg C') title( strcat('Node ', num2str(node),' - T S',num2str(Seg),' L',num2str(Lay),', RMSE=', num2str(RMSE(node)))) name = strcat('time series 18 to 1000Node ', num2str(node),' - T S',num2str(Seg),' L',num2str(Lay),'.jpg') saveas(h,name, 'jpg'); close(h)

Categories : Matlab



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.