Hello to all!
I am writing a small Django application and I should be able to create
for each model object its periodical task which will be executed with
a certain interval. I'm use for this a Celery application, but i can't understand one thing:
class ProcessQueryTask(PeriodicTask):
run_every = timedelta(minutes=1)
def run(self, query_task_pk, **kwargs):
logging.info('Process celery task for QueryTask %d' %
query_task_pk)
task = QueryTask.objects.get(pk=query_task_pk)
task.exec_task()
return True
Then i'm do following:
>>> from tasks.tasks import ProcessQueryTask
>>> result1 = ProcessQueryTask.delay(query_task_pk=1)
>>> result2 = ProcessQueryTask.delay(query_task_pk=2)
First call is success, but other periodical calls returning the error
- TypeError: run() takes exactly 2 non-keyword arguments (1 given) in
celeryd server.
So, can i pass own params to PeriodicTask run() ?
Thanks!
I have 2 projects. First project need to include second. When I copy sources from second project to first I need to modify manually import path to R.java file.
The problem is that I need to use SVN external link connection between this 2 projects, that is mean, one project (the bigger one) will take sources from another through svn and should be able to use it without any modifications.
If I would be able to specify R.java file path anywhere in project properties it will resolve my problem by changing manually that path.
Need to specify that package name of these 2 projects are different.
Another solution to resolve this problem also would be accepted.
Thank you.
What I'm trying to do is to print my two-dimensional array but i'm
lost.
The first function is running perfect, the problem is the second or maybe the way I'm
passing it to the "Print" function.
#include <stdio.h>
#include <stdlib.h>
#define ROW 2
#define COL 2
//Memory allocation and values input
void func(int **arr)
{
int i, j;
arr = (int**)calloc(ROW,sizeof(int*));
for(i=0; i < ROW; i++)
arr[i] = (int*)calloc(COL,sizeof(int));
printf("Input: \n");
for(i=0; i<ROW; i++)
for(j=0; j<COL; j++)
scanf_s("%d", &arr[i][j]);
}
//This is where the problem begins or maybe it's in the main
void print(int **arr)
{
int i, j;
for(i=0; i<ROW; i++)
{
for(j=0; j<COL; j++)
printf("%5d", arr[i][j]);
printf("\n");
}
}
void main()
{
int *arr;
func(&arr);
print(&arr); //maybe I'm not passing the arr right ?
}
Assume I have method
void SomeMethod(Action callback)
This method does some work in background thread and then invokes callback. The question is - how to block current thread until callback is called ?
There is an example
bool finished = false;
SomeMethod(delegate{
finished = true;
});
while(!finished)
Thread.Sleep();
But I'm sure there should be better way
I know that the android plattform is open source. What I am interested in is the share of open source Android apps, thus developers that realease their own apps under a open source license.
Does anybody have an idea, how to get this information?
hey I'm writing on an Server-Client program
but when my client sends something, it never reaches my server!
I'm sending like this:
public void Send(string s)
{
char[] chars = s.ToCharArray();
byte[] bytes = chars.CharToByte();
nstream.Write(bytes, 0, bytes.Length);
nstream.Flush();
}
and Receiving in a background thread like this
void CheckIncoming(object dd)
{
RecievedDelegate d = (RecievedDelegate)dd;
try
{
while (true)
{
List<byte> bytelist = new List<byte>();
System.Threading.Thread.Sleep(1000);
int ssss;
ssss = nstream.ReadByte();
if (ssss > 1)
{
System.Diagnostics.Debugger.Break();
}
if (bytelist.Count != 0)
{
d.Invoke(bytelist.ToArray());
}
}
}
catch (Exception exp)
{
MSGBOX("ERROR:\n" + exp.Message);
}
}
the ssss int is never 1
whats happening here???
Basically, this question with a difference...
Is it possible to capture print output from a TSQL stored procedure in .NET, using the Entity Framework?
The solution in the other question doesn't work for me. It works with the connection type from System.Data.SqlClient but I'm using the one from System.Data.EntityClient which does not have an InfoMessage event. (Of course, I could just create an SQL connection based on the Entity connection settings, but prefer to do it directly.)
MYMESSAGE = "<div>Hello</div><p></p>Hello"
send_mail("testing",MYMESSAGE,"[email protected]",['[email protected]'],fail_silently=False)
However, this message doesn't get the HTML mime type when it is sent. In my outlook, I see the code...
I need to find the amount of updated rows
UPDATE Table SET value=2 WHERE value2=1
declare @aaa int
set @aaa = @@ROWCOUNT
It doesn't work. How can I do that?
I am building a staff area for a website, which is completely different to the main brochure style site.
I have 2 Kohana systems setup. I realise they can both share the same system and modules folder.
Now, with the second one, I want to make the main template view a view in a different folder.
I tried this in my base controller
$this->template = DOCROOT . '../~new2/application/views/template.php';
But Kohana is looking for it in its own views folder as evident by the error I received. I even put a var_dump(file_exists($this->template)); // true to be sure it was finding the correct file.
Is there a way to add a template file that is not within the views folder, without hacking the core Kohana code (and if I'm lucky not extending and overloading the view class).
How can I select only distinct elements for the XML document using XPATH?I've tried to use the 'distinct-values' function but it didn't work for some reason..
I had VS 11 beta and the following code was working without problem:
let rec fac x y =
if (x = y) then y
elif (x % y = 0I) then fac (x / y) y
else fac x / (y + 1I);;
Now I installed VS 2012 RC and I get the following error:
The type 'System.Numerics.BigInteger -> System.Numerics.BigInteger' is not compatible with the type 'System.Numerics.BigInteger'
Is code not correct or F# interactive? It's F# 3.0.
I'd like to be able to generate a compiled expression to set a property, given the lambda expression that provides the "get" method for a property.
Here's what I'm looking for:
public Action<int> CreateSetter<T>(Expression<Func<T, int>> getter)
{
// returns a compiled action using the details of the getter expression tree, or null
// if the write property is not defined.
}
I'm still trying to understand the various types of Expression classes, so if you can point me in the right direction that would be great.
i build a new website.but the host is in USA.i am not in USA.
i need get the time on the website page to compare with one local Variable.
But because of time difference,it has 8 hous difference?how to solve this problom?
my code
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
java.util.Date currentTime = new java.util.Date();
String dateString = formatter.format(currentTime); `
how to revise these code ?
The situation:
I have an activity "A" that is a delegator activity, in simple words, it's only purpose is to call activity "B" (via startActivityForResult()) depending on data it receives. Activity "B" has launchMode set to "singleTask", so it always runs in a single task.
When activity "A" gets started from another task (for example as a share from gallery) it immediately returns ACTION_CANCELLED for activity "B", finishes, and task of activity "B" comes to front (which is an expected behavior).
So, what happens, is that we jump from our Gallery app task, to my activity "B" task. Everything is fine until user presses back. Since we are already in a different task, the back button doesn't lead us back to gallery. It navigates in the stack of activity "B" task.
The question: is there any way to navigate from one task, to previously shown task (navigate from activity "B" to gallery)? Or maybe there is a way to take currently running activity "B" and move it to another task?
I have seen this but can't work out how to apply it (no pun intended) to my situation.
I have a sorted list of maps like this: (note there can be more than two keys in the map)
({name1 3, name2 7}, {name1 35, name2 7}, {name1 0, name2 3})
What I am after is this data structure afterwards:
({:name1 [3,35,0]}, {:name2 [7,7,3]})
Ive been struggling with this for a while and cant seem to get anywhere near.
Caveats: The data must stay sorted and I have N keywords not just two.
I'm making a store web app for a college class. I'm wondering what do stores like Amazon do when there is only 1 item left?
Do they let multiple customers add the last item to their cart, and whoever checks out first gets it? Meaning that the inventory database is updated after purchase.
or
Do they let only one customer add the last item to their cart and remove the item from the inventory. If the customer's session times out, then the item is put back in the inventory.
So let's say I have a form which is being sent somewhere strange (and by strange we mean, NOT the default route:
<% form_for @form_object, :url => {:controller => 'application',
:action => 'form_action_thing'} do |f| %>
<%= f.text_field :email %>
<%= submit_tag 'Login' %>
<% end %>
Now let's say that we have the method that accepts it.
def form_action_thing
User.find(????? :email ?????)
end
My questions are thus:
How does can I make the object @form_object available to the receiving method (in this case, form_action_tag)?
I've tried params[:form_object], and I've scoured this site and the API, which I have to post below because SO doesn't believe I'm not a spammer (I'm a new member), as well as Googled as many permutations of this idea as I could think of. Nothing. Sorry if I missed something, i'm really trying.
How do I address the object, once I've made it accessible to the method? Not params[:form_object], I'm guessing.
To clearly separate the Controller and View layers, I do not longer want to pass full objects to my views. Instead I want to pass only arrays and objects that contain the data but do not have any methods. Otherwise a view script would be able to delete Doctrine records or traverse in the object tree to data that was not intended for the view.
Hi. Am I the only one experiencing this issue? I'm using the html5media library and the test page they provide no longer plays in Firefox 3.6.3, though it plays on the latest Safari, Chrome, Opera, and IE. On FF 3.6.3, it shows the video and the audio with large X through them. I'm using this library on my site and noticed the issue as well. I'm not seeing any errors in the error console.
I'm writing some C code to parse IEEE 802.11 frames, but I'm stuck trying to create a new variable whose length depends on the size of the frame itself.
Here's the code I currently have:
int frame_body_len = pkt_hdr->len - radio_hdr->len - wifi_hdr_len - 4;
u_char *frame_body = (u_char *) (packet + radio_hdr->len + wifi_hdr_len);
Basically, the frame consists of a header, a body, and a checksum at the end. I can calculate the length of the frame body by taking the length of the packet and subtracting the length of the two headers that appear before it (radio_hdr->len and wifi_hdr_len respectively), plus 4 bytes at the end for the checksum.
However, how can I create the frame_body variable without the trailing checksum? Right now, I'm initializing it with the contents of the packet starting at the position after the two headers, but is there some way to start at that position and end 4 bytes before the end of packet? packet is a pointer to a u_char, if it helps.
I'm a new C programmer, so any and all advice about my code you can give me would be much appreciated. Thanks!
Hi there,
The following always preselects the last option, but i like the first option to be preselected?
<select name="filter">
<option value="" selected>Make a choice</option>
<option value="1">1</option>
<option value="3">3</option>
<option value="7">7</option>
<option value="">all</option>
</select>
even with the first selected??
Can this be done??