Hi!
I want to add some style to head tag in html page using javascript.
var h = document.getElementsByTagName('head').item(0);
h.innerHTML += '<style>a{font-size:100px;}</style>';
But when I run this code in IE8 I see this error message:
Could not set the innerHTML property. Invalid target element for this operation.
Any ideas?
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!
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 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).
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.
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 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 ?
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?
Hi,
I am trying to filter/search a database with ajax
$.ajax({
type: "POST",
url: "filterSearch.php",
queryString: qry,
success: function(data){
alert( "Data Saved: " + data );
$('#searchResult').html(data); // Fill the search results box
}
});
Now in filterSearch.php i have the following test codes
if(isset($_POST['queryString'])) {
echo "TEST";
}
if($_POST['runquery']==1) {
$sql = "SELECT * FROM fs_vacatures WHERE here-the-like-query?";
$msg = $sql;
echo $msg;
die();
}
die();
But nor TEST or the $sql is return in the alert??
I've deployed a SSIS package to my SQL server.
I can run the package fine by connecting to Integration Services in SSMS and right clicking on it and choosing "Run Package"
However, if I schedule the package, it fails.
It tells me to check the logs for information on why, but there is nothing in there...
Any ideas?
(this is my first SSIS package by the way)
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...
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??
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 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 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.
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.
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?
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!
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.
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.