The following script returns 20 instead of 21!
var d = new Date("2010/03/21");
document.write(d.getDate());
What am I doing wrong? Is this a JavaScript bug?
Hi guys,
I'm recently new in MVC technology and i'm with a difficult
I have a UI to create a user, and when i submit the content and all content is valid i pass a message into Viewdata["INFO"] and return a View called Info with Viewdata Informing than the usar was sucefully created.
But in this moment i want to Regist a some script than, after a one delay specified the client redirects automatically to the base page "Users".
Any ideas to get the best way to do it?
Does anyone have a handy powershell script that gets a set of files from TFS based on a modification date? I'd like to say "give me all the files in this folder (or subfolder) that were modified after X/Y/ZZZZ" and dump those files to a folder other than the folder they would normally go to. I know enough powershell to hack about and get this done, eventually, but I'm hoping to avoid that.
I'm looking for a tool / script which validates the template files (php variables + html is mixed). I have tried 'tidy' but the results are not consistent as Eclipse and moreover Tidy doesn't handle such dynamic template files very well. So can anyone point me out in right direction?
I have a input that the user types a search parameter into, at the moment i have it on keyup to do a POST ajax request to a PHP script that returns search results. however its firing off 50 billion (not literally) post requests in about 10 seconds (as the user types) which slows the whole experience down. Can i use jQuery to detect a "wordup" rather than "keyup" by detecting the use of the space bar?
Does this make sense?
I tried putting this line but it doesn't work:
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
jQuery doesn't work in Greasemonkey at all. Is there other way to use jQuery in Greasemonkey?
--
For all the people who have the same problem, you must upload the file to greasespot then install it from there.
The Create New Script option wouldn't work!
I often have to modify files such as sysctl.conf, and I'm familiar with using sed to replace existing values.
Is there a way to append the new key/value pair to the file if sed wasn't able to replace it?
For instance, using this example: modify config file using bash script
sed -c -i "s/\($TARGET_KEY *= *\).*/\1$REPLACEMENT_VALUE/" $CONFIG_FILE
How could I add the $TARGET_KEY = $REPLACEMENT_VALUE new line to $CONFIG_FILE using the same sed expression with slight changes?
And on a related topic, how can I force creation of $CONFIG_FILE if it didn't exist?
I've inherited a bunch of code that has server script inside of .htm files.
On IIS, a handler mapping pumps.Htm pages though the asp.net engine.
Unfortunately, visual studio doesn't notice that they should be treated as code.
Is there any way to make VS treat .Htm files as code/aspx files?
My eventinfo.php is giving the following output:
<br />
<b>Notice</b>: Undefined index: club in <b>/homepages/19/d361310357/htdocs/guestvibe/wp-content/themes/yasmin/guestvibe/eventinfo.php</b> on line <b>11</b><br />
[]
HTML (index.php):
<select name="club" class="dropdown" id="club">
<?php getClubs(); ?>
</select>
jQuery (index.php):
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
type: "POST",
url: "http://www.guestvibe.com/wp-content/themes/yasmin/guestvibe/eventinfo.php",
data: $('#club').serialize(),
success: function(data) {
$('#rightbox_inside').html('<h2>' + $('#club').val() + '<span style="font-size: 14px"> (' + data[0].day + ')</h2><hr><p><b>Entry:</b> ' + data[0].entry + '</p><p><b>Queue jump:</b> ' + data[0].queuejump + '</p><br><p><i>Guestlist closes at ' + data[0].closing + '</i></p>');
},
dataType: "json"
});
});
$('#club').change(function(event) {
$.ajax({
type: "POST",
url: "http://www.guestvibe.com/wp-content/themes/yasmin/guestvibe/eventinfo.php",
data: $(this).serialize(),
success: function(data) {
$('#rightbox_inside').hide().html('<h2>' + $('#club').val() + '<span style="font-size: 14px"> (' + data[0].day + ')</h2><hr><p><b>Entry:</b> ' + data[0].entry + '</p><p><b>Queue jump:</b> ' + data[0].queuejump + '</p><br><p><i>Guestlist closes at ' + data[0].closing + '</i></p>').fadeIn('500');
},
dataType: "json"
});
});
</script>
I can run alerts from the jQuery, so it is active.
I've copied this as is from an old version of the website, but I've changed the file structure (through to move to WordPress) so I suspect the variables might not even be reaching eventinfo.php in the first place...
index.php is in wp-content/themes/cambridge and eventinfo.php is in wp-content/themes/yasmin/guestvibe but I've tried to avoid structuring issues by referencing the URL in full.
Any ideas?
There is a simple way with php, a simple script or URL manipulation to build a URL for the gravatar image corresponding to an email?
Ex. http://gravatar.com/avatars/[email protected] and this return a jpeg or png image.
If there is no simple way like the example, what is the easiest way you know to resolve a url of the gravatar corresponding to an email?. Thanks
Hi all,
I am learning JQuery.
In a HTML file, I got this:
<DIV ID="testing">
And I am trying to pass the ID of this DIV tag to a JQuery self-defined function:
<script>
$(function() {
$("div").mouseover(function() {
var ID = $(this).children().attr('id');
alert(ID);
});
});
But it wont work.
I've already gone thru: http://docs.joomla.org/How_to_add_breadcrumbs
and http://api.joomla.org/Joomla-Framework/Application/JPathway.html
but they don't help.
I have not found any more info in any books or internet.
My website download forms has 1000's of pages generated thru script.
I want to generate breadcrumb navigation for the pages.
Google has refused me Adsense account due to this lack of navigation.
I have created a dynamic table whose rows gets appended by click of the "Add" button, i want the user not to be able to submit the page if no value is entered in all the rows of the table.
how do i achieve this
The code is
<html>
<head>
<script type="text/javascript">
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
var iteration = lastRow+1;
var row = tbl.insertRow(lastRow);
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellLeft.appendChild(textNode);
var cellRight = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'txtRow' + iteration;
el.id = 'txtRow' + iteration;
el.size = 40;
cellRight.appendChild(el);
}
function validation()
{
var a=document.getElementById('tblSample').rows.length;
for(i=0;i<a;i++)
{
alert(document.getElementById('tblSample').txtRow[i].value);//this doesnt work
}
return true;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form name ='qqq' action="sample.html">
<p>
<input type="button" value="Add" onclick="addRowToTable();" />
<input type="button" value="Submit" onclick="return validation();" />
</p>
<p>
<table border="1" id="tblSample">
<tr>
<td>1</td>
<td>The 1st row</td>
</tr>
</table>
</p>
</form>
</body>
</html>
Please suggest
In SublimeText(2), when you press [ctrl + shift + p] (mac osx) you are shown a scope of where your caret/cursor is in the source code at the given moment e.g.: entity.name.tag.inline.any.html meta.tag.inline.any.html text.html.basic
I am curious about what library or script is used to parse the document/file and create that scope string.
A sidenote: Typing view.syntax_name(view.sel()[0].b) into Sublime's console will output the scope as well.
Please help~!
<HTML>
<HEAD>
<TITLE>Bra Size to Chest Size Converter - CM</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function CalculateSum(Atext, Btext, form)
{
var A = BratoNum(Btext);
var B = parseFloat(CuptoNum(Btext));
form.Answer.value = A + B;
}
function ClearForm(form)
{
form.input_A.value = "";
form.input_B.value = "";
form.Answer.value = "";
}
function BratoNum(str)
{
switch(str.toUpperCase()) {
case "32": return 70;
case "34": return 75;
case "36": return 80;
case "38": return 85;
case "40": return 90;
default: alert('You must enter a number between 32 and 40!');
return 'X';
}
}
function CuptoNum(str)
{
switch(str.toUpperCase()) {
case "A": return 4;
case "B": return 5;
case "C": return 6;
case "D": return 7;
case "E": return 8;
case "F": return 9;
default: alert('You must enter a letter between A and F!');
return 'X';
}
}
// end of JavaScript functions -->
</SCRIPT>
</HEAD>
<BODY>
<P><FONT SIZE="+2">Bra Size to Chest Size Converter</FONT></P>
<FORM NAME="Calculator" METHOD="post">
<P>Enter Bra Size: <INPUT TYPE=TEXT NAME="input_A" SIZE=8></P>
<P>Enter Cup Size: <INPUT TYPE=TEXT NAME="input_B" SIZE=8></P>
<P><INPUT TYPE="button" VALUE="Get Chest Size" name="AddButton" onClick="CalculateSum(this.form.input_A.value, this.form.input_B.value, this.form)"></P>
<P>Your Chest Size is <INPUT TYPE=TEXT NAME="Answer" SIZE=8> inch</P>
<P><INPUT TYPE="button" VALUE="Clear" name="ClearButton" onClick="ClearForm(this.form)"></P>
</FORM>
</BODY>
</HTML>
I would like to create a python script, which will:
Create a django project in the current directory. Fix settings.py, urls.py.
Do syncdb
Install new apache instance listening on specific port (command line argument), with WSGI configured to serve my project.
I can't figure out how to do point 3.
EDIT:
Peter Rowell:
I need the solution for both Linux and Windows
I have root access
This is a dedicated host
Apache only
Hi,
I have 2 database:
production and to test.
Production should have the same fields and tables like testdatabase.
is there any software, or script to show difference between this two databases?
I am preparing a script. I am using AJAX(load()) with jQuery.
I am getting a page which includes textarea with ckeditor by load() jQuery AJAX function.
Although I include ckeditor's.js file, loaded page doesn't includes javascript file and shows a normal textarea without ckeditor.
How can I load file which includes textarea with ckeditor?
What does the following code mean -
<a href="javacsript:;" onClick="addItem(160)">some link</a>
My basic doubt is which script is run when we click on the link
Hello everyone:
I've got a typical problem when trying to insert a date into MySQL.
The column defined in MySQL is of type DATE. My PHP version is 5.3.0
Apart from this date-related issue, the rest of my code works just fine.
And this is my PHP script to do this:
$tablename = BOOKS_TABLE;
$insert = mysql_query("INSERT INTO $tablename (barcode, book_name, volume_num,".
" author, publisher, item_type, buy_price, buy_date) VALUES ".
"(".
"'" . $barcode . "', ".
"'" . $bookname . "', ".
"'" . $volumenum . "', ".
"'" . $author . "', ".
"'" . $publisher . "', ".
"'" . $itemtype . "', ".
"'" . $buyprice . "', ".
"'" . getMySQLDateString($buydate).
//"'STR_TO_DATE('".$buydate ."', '%d/%m/%Y'))'". //nothing changes in MySQL
")");
And this is the faulty function :
function getMySQLDateString($buydate) //typical buydate : 04/21/2009
{
$mysqlDateString = date('Y-m-d H:i:s', $strtotime($buydate));
return $mysqlDateString;
}
The first commented out line wouldn't do anything, the script is executed with no error, however, there is nothing changed in datebase after this.
The current approach will cause a Fatal error saying function name must be a string in this line.
Actually I followed this thread on SO, but just cannot pass the date into MySQL...
Can anyone help me figure out which part is not right?
How would you do it, in this case, to get it right?
Sorry about such a journeyman-like question, thanks a lot in advance.
What is the best way to validate a crontab entry with PHP? Should I be using a regex, or an external library? I've got a PHP script that adds/removes entries from a crontab file, but want to have some way to verify that the time interval portion is in a valid format.
I'm using Flash Builder 4.6. As a simple example, say I have the following application:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:sdk="services.sdk.*">
<fx:Script>
<![CDATA[
private function btnGetValue_clickHandler():void
{
getValueResult.token = sdk.getValue();
}
private function getValueResultHandler():void
{
// ...
}
]]>
</fx:Script>
<fx:Declarations>
<sdk:SDK id="sdk" fault="{Alert.show(event.fault.faultString +'\n\n'+ event.fault.faultDetail, 'SDK ERROR');}" showBusyCursor="false"/>
<s:CallResponder id="getValueResult" result="getValueResultHandler()"/>
</fx:Declarations>
<s:Button id="btnGetValue" click="btnGetValue_clickHandler()" label="Get Value" />
</s:Application>
So when you click on the button, it calls a PHP file and when it gets a result, it calls getValueResultHandler(). Easy enough.
But what if the response from the PHP file takes a second or two and the user clicks the button rapidly? Then the result handler function may not get called every time, since the call responder gets a new token before it received the last response.
Is there a standard way of resolving this issue? I came up with the following workaround, and it works fine, but it seems like this issue would be common enough to have a more built-in solution.
My workaround is:
var getValueResultProcessing:Boolean = false;
private function btnGetValue_clickHandler():void
{
var interval:uint = setInterval(function():void
{
if (!getValueResultProcessing)
{
getValueResultProcessing = true;
getValueResult.token = sdk.getValue();
clearInterval(interval);
}
}, 100);
getValueResult.token = sdk.getValue();
}
private function getValueResultHandler():void
{
getValueResultProcessing = false;
// ...
}
Any better way of resolving this issue?
Assuming that I have the following directory structure for a Python project:
config/ scripts/ src/
where should a fabric deployment script should go? I assume that it should be in scripts, obviously, but for me it seems more appropriate to store in scripts, the actual code that fires up the project.