w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Celerybeat not executing periodic tasks
celerybeat will just schecdule task, wont execute it. To execute task you need to also start worker. You can start celery beat as well as worker together. I use "celeryd -B" In your case it should look like: /usr/local/myapp/src/manage.py celery worker --beat --schedule=/tmp/celerybeat-schedule-myapp --pidfile=/tmp/celerybeat-myapp.pid --loglevel=INFO or /usr/local/myapp/src/manage.py celeryd -B --schedule=/tmp/celerybeat-schedule-myapp --pidfile=/tmp/celerybeat-myapp.pid --loglevel=INFO

Categories : Python

How to send periodic tasks to specific queue in Celery
I found solution for this problem: 1) First of all I changed the way for configuring periodic tasks. I used @periodic_task decorator like this: @periodic_task(run_every=crontab(minute='5'), queue='celery_periodic', options={'queue': 'celery_periodic'}) def recalc_last_hour(): dt = datetime.utcnow() prev_hour = datetime(dt.year, dt.month, dt.day, dt.hour) - timedelta(hours=1) log.debug('Generating task for hour %s', str(prev_hour)) recalc_hour.delay(prev_hour) 2) I wrote celery_periodic twice in params to @periodic_task: queue='celery_periodic' option is used when you invoke task from code (.delay or .apply_async) options={'queue': 'celery_periodic'} option is used when celery beat invokes it. I'm sure, the same thing is

Categories : Python

Changing the backgound color of a div for a specified period of time then reverting in ASP .Net
This will change the color of a div to green for 2 seconds function flashGreen(divID) { var element = document.getElementById(divID); var currentColor = element.style.backgroundColor; element.style.backgroundColor = '#0F0'; setTimeout(function () { element.style.backgroundColor = currentColor }, 2000); } You just need to call it when you want to trigger the event. For example, with a button: <asp:Button runat="server" OnClientClick="javascript: flashGreen('Display');return false;"/>

Categories : Javascript

Write SQL Code to automate the changing of the parameter year and period
SET @start = DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()-13), 0) SET @stop = DATEADD(MONTH, 1, @start) The -13 moves everything back 13 days. - The 1st to 13th of each month, are moved to a date in the previous month - The 14th onwards of each month, stay in the same month The DATEADD(DATEDIFF()) rounds the date down to the beginning of the month. In this way the 1st to 13th of every month are rounded down to the 1st of the previous month. And the 14th onwards are rounded down to the 1st of the current month. The end date is then simply the value calculated above, plus 1 month.

Categories : SQL

Tasks targeted at dynamic backend fail frequently, silently
Which runtime are you using on the backend? Try running the backend for a bit without dynamic set to true and exercise the failing component. On my project, I have seen tasks that target a static backend disappear on occasion, but no where near the rate you are seeing.

Categories : Google App Engine

remove initial period and text after final period in string
This regex does what you want: ^.+|.[^.]*$ Replace its matches with the empty string. In R: gsub("^\.+|\.[^.]*$", "", subject, perl=TRUE); Explanation: ^ # Anchor the match to the start of the string .+ # and match one or more dots | # OR . # Match a dot [^.]* # plus any characters except dots $ # anchored to the end of the string.

Categories : Regex

Changing SQL user name to user name with period
Try to put brackets around the new username (the dotted one): ALTER USER testtest WITH NAME = [test.test]; Otherwise the dot would be treated as separator between schema and username.

Categories : SQL

The "bag of tasks" concept in C#, enqueue,pause,cancel logical tasks
Yes, you can do that. First, you have a main thread, your application. There you have two workers, represented by threads. The first worker would be a producer and the second worker would be a consumer. When your application starts, you start the workers. Both of them operates on the concurrency collection, the bag. Producer searches for files and puts references to the bag and consumer takes references from the bag and starts a task per reference. When you want to signal pause, simply pause the producer. If you do that, consumer also stops working if there is nothing in the bag. If this is not a desired behaviour, you can simply define that pausing of the producer also clears the bag - backup your bag first and than clear it. This way all running tasks will finish their job and consumer

Categories : C#

SecurityException when enumerating V1 tasks and displaying tasks' info using a DataGrid
This is courtesy of dahall over at codeplex (Thanks a lot dahall) First, try putting brackets in around the scope of your first using statement. You can also do the same with the TaskService instance. You could do this by doing: List<TaskInfo> taskList = new List<TaskInfo>(); using (TaskService ts = new TaskService(REMOTE", "username", "domain", "password", osVer.Contains("2003"))) { EnumFolderTasks(ts.RootFolder, taskList); } DataContext = taskList; I am not sure why this happens only for the V1 calls, but this did solve my problem.

Categories : C#

Format input field to separate the first 4 digits with a period, and the next 2 digits with a period
you can use input boxes of required length ex: <input type="text" maxlength="4">.<input type="text" maxlength="2">.<input type="text" maxlength="4">

Categories : Javascript

Changing the properties of dynamic object
try to call this function after the slider created function test() { $('.pic').css('width','1000px'); $('.pic').css('background-position','550px'); }

Categories : Jquery

Dynamic href changing source from mysql
Seems like your variable @{c.content} is not being parsed. I'm not familiar with Thymeleaf but Wikipedia seems to suggest that you should use ${c.content} instead? UPDATE We figured out that the actual syntax for using a variable in href is @{${c.content}}

Categories : Mysql

Dynamic width changing jquery, what is wrong?
First of all, why not just using css width: 31.67%? Then you should wrap your code in $(document).ready(), because that will make sure that your silder allready exists when you call $(window).resize(). $(document).ready(function() { $(window).resize(function(){ $('#homeSlider').css({ width: ($(window).width())*0.3167 }); }); $(window).resize(); });

Categories : Jquery

Append divs changing his content dynamic
fixed. changed cdefault id to id0 and this java script: var i = 2; var c = 0; function add() { $xpto = 'gtitle'+i; $xpto2 = 'gmessage'+i; var klon = $( '#id'+ c ); klon.clone().attr('id', 'id'+(++c) ).insertAfter( '#inserthere' ); document.getElementById('id'+(c)).style.display = '' ; $("#id"+(c)+" input[id='gtitle1']").attr('name', $xpto); $("#id"+(c)+" textarea[id='gmessage1']").attr('name',$xpto2); i++; }

Categories : Forms

WinForms PropertyGrid: dynamic StandardValuesCollection changing
You can use the context parameter and get the current property value, something like this: public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { // get the current property value string value = (string)context.PropertyDescriptor.GetValue(context.Instance); return new StandardValuesCollection(GetFilteredList(value)); }

Categories : C#

dynamic marking changing content JavaScript
You have to poll AJAX request to the server after every few seconds or minutes and see if there's any update. If so, you receive that update with say the id or index number of the data which you can replace with the new one. That way you won't have to update the entire thing.

Categories : Javascript

Count within a time period, a group of a smaller time period
Yup, possible with a GROUP BY and a HAVING, using some UNIX_TIMESTAMP rounding (subtracting stamp % 300 from stamp) to group into blocks of 300 seconds (5 minutes). SELECT COUNT(*), MIN(stamp) FROM mytable WHERE stamp >= NOW() - INTERVAL 30 minute GROUP BY FROM_UNIXTIME( UNIX_TIMESTAMP(stamp) - MOD(UNIX_TIMESTAMP(stamp),300) ) HAVING COUNT(*) >= 4 This assumes that you mean clock blocks rather than rolling blocks, i.e. you want from 00:00:00 to 00:04:59 etc., rather than from 13:23:01 to 13:28:00. This causes some issues with the "30 minutes ago" rule, so you might want to think that one through a bit carefully. EDIT: Well seeing as you insisted on making it a rolling block... let's add some delicious awfully-performing joining. SELECT COUNT(*), rolling.s

Categories : Mysql

Changing a “static” slider into a dynamic, easily changeable one
Well, ofcruse the best way to do it is to write your own code, so you can have exactly what you want. but in you situation, i would advis just to download new plug in and make all the changes via the admin panel. I looked up for some sliders, just choose what ever you like on this link.

Categories : Jquery

Perl: Changing values of a dynamic array reference
Here is an example of how to loop through your datastructure. I used Data::Dumper to look into them. It should make clear how it is structured. #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $data1 = [{ id => 1, name => 'A' },{ id => 2, name => 'B' },{ id => 3, name => 'C' },{ id => 4, name => 'A' },]; print "Before: " . Data::Dumper->Dump($data1)." "; foreach (@$data1){ if ($_->{name} eq 'A'){ $_->{id} = 1; } } print "After: " . Data::Dumper->Dump($data1)." "; Your $data1 is an array-reference. Its dereferenced (@$data1) so we can loop through it with foreach and access the hashes within. As we're still using the refenrences we edit them "in place".

Categories : Perl

Form dynamic attribute changing and submission not working
You don't need to clone() the form. Try this: var Submit2 = function() { var form = $("#mainForm"); form.prop("action", "/testing"); form.submit(); } Updated fiddle

Categories : Javascript

changing a form field within a view to have dynamic attrs
There's nothing really wrong with that, but a better way to do it is to modify the field's validators attribute rather than toss out the whole definition: form.fields['quantity'].validators.append(validators.MaxValueValidator(quantity)) Just changing max_value on the field won't do anything, because that value is only checked during the IntegerField's __init__ method. You could do this in the form's __init__ method instead of the view - I'd probably lean that way just to be sure I didn't forget to set it somewhere. Another perfectly fine way to do it is to check the DB in a custom clean_quantity method on the form: def clean_quantity(self): available_quantity = # some database lookup if self.cleaned_data['quantity'] > available_quantity: raise forms.ValidationError

Categories : Django

Django: dynamic form generation (changing field type)
IMO, there's almost always a better idea than dynamic model fields. However maybe this app will help you or at least give you direction: https://github.com/dobarkod/django-dynamic-model

Categories : Django

Changing height dynamic for Table Rows , CustomCell and Layout
Hear is another way try this change according to ur code it may different, but it may solve your problem.I am putting all views through code only, because it is easy for me check this out. //in your subclassed class - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code //may be u did same i am adding the label to cell UILabel *nameLabel = [[UILabel alloc]initWithFrame:CGRectZero]; nameLabel.numberOfLines = 5; //set number of lines nameLabel.tag = 100; [self addSubview:nameLabel]; UILabel *otherLabel = [[UILabel alloc] initWithFrame:CGRectZero]; otherLabel.tag = 200; [self addSubview:otherLabel];

Categories : Objective C

Reading dynamic/changing data from multiple threads without locks? Can it cause a crash? Or just corrupted variables?
Reading and writing to same data objects from multiple threads gives you Undefined Behavior and Undefined behavior does not mandate a crash, it simply means that the program can show any behavior. Simply put you cannot rely on the behavior to be consistent because it is simply not mandated as per the standard. The only safe way to access such a object will be to ensure: Atomic & synchronized accesses through locks

Categories : C++

Serve dedicated HTML page to Google crawler without changing the URL to make for dynamic content
The solution is to add the meta tag: <meta name="fragment" content="!"> More details there.

Categories : Ajax

Periodic table with css
I guess you can achieve it using CSS3 like below... It will hide the DIV... Please change the property if required div[class^=pos_]{ display:none !important; } Updated CSS for element class is below: remove display: table-cell; div {display: table-row; vertical-align: inherit; border-radius: 7px; -moz-border-radius: 7px; -webkit-border-radius: 9px; border: 3px solid #FFF; } .element{text-align: center; padding: 10px 5px; vertical-align: inherit; min-width: 5em; border: 2px #FFF solid; background-color: red; }

Categories : CSS

Periodic intervals
Let's see... The offset between two consecutive intervals is $start + $end + $period. The start of interval k is therefore at k * ($start + $end + $period) + $start. By dividing x from a given Interval (new Interval(x, y)) by $start + $end + $period we can calculate our k: // this is should be integer division... $k = ($interval->start - $period->interval->start) / ($period->interval->start + $period->interval->end + $period->period); Now we can calculate the bounds of interval k and check if the given interval is inside of it. $kStart = $k * ( $period->interval->start + $period->interval->end + $period->period ) + $period->interval->start; $kEnd = $kStart + ($period->interval->end - $period->interval->start); re

Categories : Misc

How to create periodic task
You can try with Observable.Timer which Returns an observable sequence of timer.

Categories : C#

Trying to make a periodic table
For minimal changes to your existing code, you could set a flag found if the element is found, and act on it accordingly. So: found = False for line in f: # .... if name == key: print(val) found = True elif ... if not found: print("Not an element or atomic number: {}".format(name))

Categories : Python

Periodic notification with Pusher
No, Pusher doesn't offer a cron feature. But, it would be easy to use a service like iron.io and then hit your own endpoint every two minutes and from that endpoint publish to Pusher. See: IronMQ Push Queues Add Messages to a Queue docs - specifically the 'delay'. This means you can define when you want the message to be queued and effectively published.

Categories : Ruby On Rails

How to do an action in periodic intervals in java?
Are you using some kind of UI? There are at least two timers available in Java; javax.swing.Timer java.util.Timer Which should be capable of achieving what you want There are also 3rd party libraries that might help as well

Categories : Java

Synchronize periodic Task with another Thread
Both Timer and ScheduledExecutorService can execute tasks at fixed rates or with fixed delays between executions. That means, a scheduled task with fixed rates will compensate the running time (including blocking time) of the execution. A scheduled task with fixed delays will not. See the documentation of the following methods for more information: Fixed rate: Timer.scheduleAtFixedRate and ScheduledExecutorService.scheduleAtFixedRate Fixed delay: Timer.schedule and ScheduledExecutorService.scheduleWithFixedDelay There is always a better way. However, the solution looks fine. And as long as it works for you, go with it.

Categories : Java

Convolving a periodic image with python
image2d = [[0,0,0,0,0], [0,0,0,1,0], [0,0,0,0,0], [0,0,0,0,0]] kernel = [[1,1,1], [1,1,1], [1,1,1]] image2d = np.asarray(image2d) kernel = np.asarray(kernel) img_f = np.fft.fft2(image2d) krn_f = np.fft.fft2(kernel, s=image2d.shape) conv = np.fft.ifft2(img_f*krn_f).real >>> conv.round() array([[ 0., 0., 0., 0., 0.], [ 1., 0., 0., 1., 1.], [ 1., 0., 0., 1., 1.], [ 1., 0., 0., 1., 1.]]) Note that the kernel is placed with its top left corner at the position of the 1 in the image. You would need to roll the result to get what you are after: k_rows, k_cols = kernel.shape conv2 = np.roll(np.roll(conv, -(k_cols//2), axis=-1), -(k_rows//2), axis=-2) >>> conv2.round() ar

Categories : Python

Is it possible to trigger periodic events from a WCF Service?
Not really a good way in a WCF service If the service is going to get some use you may be able to store the NextHeartBeat timestamp and every request check if it's time to send out a message to the master server.

Categories : C#

Handling a periodic thread in MVVM
In particular, in my view, I have a data grid with some rows. The application needs to run a thread when this window is active and this thread needs, periodically, to access the grid's rows and perform some task with data collected from each row. I think your application doesn't need to access the grid's rows. Instead, it needs to access the data that is bound to the grid's rows. You should then create your background worker (or thread) in your ViewModel, as you thread doesn't need to know anything about the View.

Categories : C#

Identifying start of non-periodic cycles in Matlab
I would try filtering the data then looking for sign changes in the derivative, rather than thresholding it. B = fir1(8,0.5); newData = filtfilt(B,1,data); dt = [0 sign(diff(newData))]; ddt = -[0 diff(dt)]; localMaxima = data(ddt>0); idx = find(ddt>0); plot(1:length(data),[data;newData;ddt*max(data)])

Categories : Matlab

Periodic javascript requests stop happening
I would try the caching problem. Try to add a timestamp after each request .. i. e. something like this: var update_temp = function (){ $('current_temp').load("/api/temp?killcache=" + (new Date()).getTime()); } update_temp.periodical(1000);

Categories : Javascript

How do I create a periodic Poller with Play 2.0 and Scala
I would start by switching your actor over to Akka. Play is already built on top of Akka and the scala actor API has been deprecated and will be removed soon. Then, you can leverage the Akka ActorSystem Scheduler to handle the scheduling aspect and let the actor itself only handle the polling. The refactored actor could look like this: import akka.actor._ class PollingActor extends Actor{ def receive = { case "poll" => //do polling work here } } Then schedule it's execution outside of the actor. All you need is a reference to the ActorSystem that play is running on top of: import scala.concurrent.duration._ val poller = system.actorOf(Props[PollingActor], "poller") val cancellable = system.scheduler.schedule(0 milliseconds, 100 milliseconds, poller, "poll") In

Categories : Scala

periodic state machine with boost statechart
Having worked with boost MSM, statecharts and QP my opinion is that you are on the right track with statecharts. MSM is faster but if you don't have much experience with state machines or meta programming the error messages from MSM are hard to understand if you do something wrong. boost.statecharts is the cleanest and easiest to understand. As for QP its written in embedded style (lots of preprocessor stuff, weaker static checking) although it also works in a PC environment. I also believe its slower. It does have the advantage of working on a lot of small ARM and similar processors. Its not free for commercial use as opposed to boost solutions. Making an event for every type of state change does not scale. I would make one type of event EvStateChanged give it a data member containing a

Categories : Misc

Periodic timer stops unexpectedly, after 61 runs
I believe your timer is getting garbage collected as a result of the runtime optimizing and determining that the timerEvery5 variable is no longer being referenced in the method... Try setting it to a static variable and see if it fixes the issue. That or call GC.KeepAlive(timerEvery5); AFTER the sleep loop, since that call keeps the variable un-GC'd until the method is executed (sort of unintuitive). EDIT: per this link: http://msdn.microsoft.com/en-us/library/system.timers.timer.aspx see the first example as it is a similar issue. A quote from the example: // If the timer is declared in a long-running method, use // KeepAlive to prevent garbage collection from occurring // before the method ends. //GC.KeepAlive(aTimer);

Categories : C#



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