Is there a library function in c# for the mathematical modulus of a number - by this I specifically mean that a negative integer modulo a positive integer should yield a positive result.
I want to be able to get information about the selected item in the ordered list whose ID is #selectable. The below code returns the ID #selectable, I'm looking for the id of the item I just selected.
$('#selectable').selectable({
selected: function (event, ui) {
alert($(this).attr('id').toString());
}
});
Any ideas?
I need to theme tabs on a certain number of pages "user/*". If i simply use theme_menu_local_task in template.php, it will use the function on all pages, not only on "user/*".
Is there a way to theme only "user/" pages and leave others alone?
I've created a code to change a password. Now it seem contain an error. When I fill in the form to change password, and click save the error message:
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\Program Files\xampp\htdocs\e-Complaint(FYP)\userChangePass.php on line 103
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\Program Files\xampp\htdocs\e-Complaint(FYP)\userChangePass.php on line 103
I really don’t know what the error message means. Please guys. Help me fix it.
Here's is the code:
<?php session_start(); ?>
<?php # change password.php
//set the page title and include the html header.
$page_title = 'Change Your Password';
//include('templates/header.inc');
if(isset($_POST['submit'])){//handle the form
require_once('connectioncomplaint.php');//connect to the db.
//include "connectioncomplaint.php";
//create a function for escaping the data.
function escape_data($data){
global $dbc;//need the connection.
if(ini_get('magic_quotes_gpc')){
$data=stripslashes($data);
}
return mysql_real_escape_string($data, $dbc);
}//end function
$message=NULL;//create the empty new variable.
//check for a username
if(empty($_POST['userid'])){
$u=FALSE;
$message .='<p> You forgot enter your userid!</p>';
}else{
$u=escape_data($_POST['userid']);
}
//check for existing password
if(empty($_POST['password'])){
$p=FALSE;
$message .='<p>You forgot to enter your existing password!</p>';
}else{
$p=escape_data($_POST['password']);
}
//check for a password and match againts the comfirmed password.
if(empty($_POST['password1'])) {
$np=FALSE;
$message .='<p> you forgot to enter your new password!</p>';
}else{
if($_POST['password1'] == $_POST['password2']){
$np=escape_data($_POST['password1']);
}else{
$np=FALSE;
$message .='<p> your new password did not match the confirmed new password!</p>';
}
}
if($u && $p && $np){//if everything's ok.
$query="SELECT userid FROM access WHERE (userid='$u' AND password=PASSWORD('$p'))";
$result=@mysql_query($query);
$num=mysql_num_rows($result);
if($num == 1){
$row=mysql_fetch_array($result, MYSQL_NUM);
//make the query
$query="UPDATE access SET password=PASSWORD('$np') WHERE userid=$row[0]";
$result=@mysql_query($query);//run the query.
if(mysql_affected_rows() == 1) {//if it run ok.
//send an email,if desired.
echo '<p><b>your password has been changed.</b></p>';
include('templates/footer.inc');//include the HTML footer.
exit();//quit the script.
}else{//if it did not run OK.
$message= '<p>Your password could not be change due to a system error.We apolpgize for any inconvenience.</p><p>' .mysql_error() .'</p>';
}
}else{
$message= '<p> Your username and password do not match our records.</p>';
}
mysql_close();//close the database connection.
}else{
$message .='<p>Please try again.</p>';
}
}//end oh=f the submit conditional.
//print the error message if there is one.
if(isset($message)){
echo'<font color="red">' , $message, '</font>';
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<body>
<script language="JavaScript1.2">mmLoadMenus();</script>
<table width="604" height="599" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="130" colspan="7"><img src="images/banner(E-Complaint)-.jpg" width="759" height="130" /></td>
</tr>
<tr>
<td width="100" height="30" bgcolor="#ABD519"></td>
<td width="100" bgcolor="#ABD519"></td>
<td width="100" bgcolor="#ABD519"></td>
<td width="100" bgcolor="#ABD519"></td>
<td width="100" bgcolor="#ABD519"></td>
<td width="160" bgcolor="#ABD519">
<?php include "header.php"; ?> </td>
</tr>
<tr>
<td colspan="7" bgcolor="#FFFFFF">
<fieldset><legend> Enter your information in the form below:</legend>
<p><b>User ID:</b> <input type="text" name="username" size="10" maxlength="20" value="<?php if(isset($_POST['userid'])) echo $_POST['userid']; ?>" /></p>
<p><b>Current Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p>
<p><b>New Password:</b> <input type="password" name="password1" size="20" maxlength="20" /></p>
<p><b>Confirm New Password:</b> <input type="password" name="password2" size="20" maxlength="20" /></p>
</fieldset>
<div align="center"> <input type="submit" name="submit" value="Change My Password" /></div>
</form><!--End Form-->
</td>
</tr>
</table>
</body>
</html>
When linking with ld (SunOS 5.10, Sun Studio 12), what is the list of possible tokens that are accepted by ld -D?
Neither man ld nor ld --help reveals the proper list. Namely, I need full information on the missing symbols (not just the demangled name of a C++ function).
I've set a view var in bootstrap file like this:
protected function _initVars()
{
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$view = $layout->getView();
$view->theme = 'MY_THEME';
}
My application.ini has following line as well:
resources.view[] =
But inside view scripts,
<?php echo $this->theme ?>
prints nothing.
i added a profile field to registration form. how to show in edit registration (account) form . i wrote a module for edit account in that $form [function editregistration_form_user_profile_form_alter(&$form, &$form_state) ] doesn't contain the values of custom profile fields.
Hi,
I'm developing a operating system and I need a test program (function of any kind) to test certain internal features.
I cannot find any appropriate program to do this job. Probably one of you knows one.
The program should be open source, written in C with very little user library usage (only file IO, pthreads, stdio, stdlib preferred) and must have a binary size of at least 2MB.
Thanks for any suggestions.
I have a hex string (length 48 chars) that I want to convert to raw bytes with the pack function in order to put it in a Win32 vector of bytes.
How I can do this with Perl?
how do i make the div refresh, say after 10 secs and execute the run_query() function without clicking on the button?
<script src="scripts/ajax.js" type="text/javascript"></script>
<div id="quote"><strong>Quote of the Day</strong></div>
<div><a style="cursor:pointer" onclick="run_query()">Next quote …</a></div>
function Sort(td)
{
var t=document.getElementById("theList");
var rows=t.getElementsByTagName("td");
var cells=t.cells;
var bb=true;
while(bb==true)
{
alert(bb);
for(var i=1;i<rows.length;i++)
{
if(cells[td.cellIndex+i*4].innerText<cells[td.cellIndex+(i+1)*4].innerText)
{
}
}
alert("Works");
}
}
The second alert will not be used. Can you tell me why?enter code here
Does ASP.NET's ScriptManager have any sort of "helper" for binding to HTML control events? This would be similar to jQuery:
$('#foo').bind('click', function() {
alert('User clicked on "foo."');
});
I'm tring to find the maximum weight subsequence of an array of positive integers - the catch is that no adjacent members are allowed in the final subsequence.
The exact same question was asked here, and a recursive solution was given by MarkusQ.
He provides an explanation, but can anyone help me understand how he has expanded the function? How does this solution take into consideration non-adjacent members?
I want to be able to get the current CPU usage in a C++ program running under Wince.
I found this link that states where the source code is but I cannot find it in my platform builder installation - I expect this is because it isn't the Windows Automotive platform.
Does anyone know where I can find this source code or (even better) know how I can get this information directly? i.e. what DLL / function calls to make etc.
I want to select all the children of the body element before element with id foo (which is a child of body). Since it doesn't look like there are :before() or :after() selectors, I've got it working like this:
$('body > :first').nextUntil('#foo').andSelf();
but it seems kludgy. Could this be done with fewer function calls, or more efficiently? Maybe something akin to $('body > *:before(#foo)') ?
I have a table with a bunch of cells. (No way! Amazing! :P) Some of the cells have a small div that when you put your mouse over, it gets bigger so you can read all the text. This works well and all. However, since html elements that come later in the document have a higher z-index, when the div gets bigger it is underneath the other divs in the other cells.
Some html code:
<table>
<tr>
<td>
limited info
<div style="position: relative;">
<div style="position: absolute; top: 0; left: 0; width: 1em; height: 1em;" onmouseover="tooltipshow(this)" onmouseout="tooltiphide(this)">
informative long text is here
</div>
</div>
</td>
<td>
some short info
<div style="position: relative;">
<div style="position: absolute; top: 0; left: 0; width: 1em; height: 1em;" onmouseover="tooltipshow(this)" onmouseout="tooltiphide(this)">
longer explanation about what is really going on that covers the div up there ^^^. darn!
</div>
</div>
</td>
</tr>
</table>
Some js code:
function tooltipshow(obj)
{
obj.style.width = '30em';
obj.style.zIndex = '100';
}
function tooltiphide(obj)
{
obj.style.width = '1em';
obj.style.zIndex = '20';
}
It doesn't matter if I set z-index dynamically to something higher onmouseover. It's like z-index has no affect. I think it has something to do with the table.
I've tested this in FF3. When I'm feeling particularly macho, I'll test it in IE.
Hi, I already have my operators for, by example, eat banana problem
[#op{
action = [climb, on, {object}],
preconds = [[at, {place}, {object}], [at, {place}, me],
[on, floor, me], [on, floor, {object}], [large, {object}]],
add_list = [[on, {object}, me]],
del_list = [[on, floor, me]]
},
But how can I use it in the function solve(Problem, depth_first, []). And depth_first (Problem, Start) - search_tree(Problem, container.stack, Start).
Hi i got this text
2/92/20
3/32/32
4/62/6
5/22/28
6/60/61
7/33/32
8/34/31
9/31/19
10/19/19
11/34/39
12/32/32
14/19/25
15/45/37
16/32/32
17/84/36
18/72/33
and i need it to be like
// 2/92/20
chars[0][0]=2;
chars[0][1]=92;
chars[0][2]=20;
How should i make that
PS: the split must be in
$.ajax({
type: "POST",
url: "char_info2.php",
dataType: "html",
success: function(data)
{
//here
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript">
function load(thediv, thefile)
{
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP)');
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(thediv) .innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open('GET', thefile, true);
xmlhttp.send();
}
</script>
</head>
<body>
<?php
//connection to db and mysql query
$result = mysql_query($query) or die(mysql_error());
$options="";
while ($row=mysql_fetch_array($result)) {
$id=$row["idProducts"];
$thing=$row["country"];
$options.="<OPTION VALUE=\"$id\">".$thing.'</option>';
}
mysql_close();
?>
<SELECT id="countrySearch" NAME=countrySearch onchange="load('divtest', 'step2.search.php')";>
<OPTION VALUE=0>Choose
<?=$options?>
</SELECT>
<div id="divtest">
test
</div>
</body>
step2.search.php consists of:
<?php
echo "I want it to store the users selection as a variable for php to use";
?>
The problem I have is I want to store what the user selects from the drop down box and use it in php to do a mysql query using the variable from the user select form to form the WHERE part of the mysql statement. Then use ajax to put new data in "divtest".
How can I store the user selection into a variable then send it to be used in step2.search.php?
I'm having a hell of a time trying to get (what I thought was) a simple index from a collection of multiple sliders. The HTML is as follows:
<div id="left-values" class="line">
<span id="l1" style="padding: 0 1.8em;">0</span>
<span id="l2" style="padding: 0 1.8em;">0</span>
<span id="l3" style="padding: 0 1.8em;">0</span>
<span id="l4" style="padding: 0 1.8em;">0</span>
<span id="l5" style="padding: 0 1.8em;">0</span>
<span id="l6" style="padding: 0 1.8em;">0</span>
<span id="l7" style="padding: 0 1.8em;">0</span>
<span id="l8" style="padding: 0 1.8em;">0</span>
</div>
And the jQuery code is:
// setup audiometry sliders
$("#eq > span").each(function (e) {
// read initial values from markup and remove that
var value = parseInt($(this).text());
// var index = $(this).index; <- this didn't work.
$(this).empty();
$(this).slider({
value: value,
slide: function (event, ui) {
//console.log($(this).attr('id')); <- neither did this.
//console.log(index);
$('#left-values span:first').text(ui.value);
}
})
});
The problem is that jQuery UI - when creating a slider - replaces the existing HTML with its own markup. This includes any ID values and, for whatever reason, I can't get the index for a given slider to surface either. So I'm running out of ideas.
Hi all,
I would like to dynamically create a PHP object, and parameters would be optional.
For example, instead of doing this:
$test = new Obj($param);
I would like to do something like this (create new ob is fictional):
$test = create_new_obj('Obj', $param);
Is there such function in php? Something similar to call_user_func_array, but for object instead.
In PHP 5.2.3, "fdopen" was used to read/write to a file descriptor that's opened by another application.
fdopen(<fileDescriptorId>,"rw"); //It worked fine with PHP 5.2.3
After upgrading PHP to 5.3.2, it's throwing "undefined reference to 'fdopen' function".
Please suggest whats the replacement for this in PHP 5.3.2 or any workaround.
hi to all
I am talking about Oracle Apps Projects module.
In Projects module there is a Project Status Inquiry which includes
Percent Complete functionality. I want information regarding this functionality.
Is it updated automatically? Does it require us to run any pre-requisites?
Please give me information about what this function does.
thanks
Nil