JQuery UI color change
Observed a strange behavior for my UI, when I see my UI which is developed
with JQuery, the color combination changes for a high resolution PC, even
after making all color set up possible. Any Idea how can I fix this?
Thursday, 3 October 2013
Wednesday, 2 October 2013
PHP: $_SESSION doesn't seem to get set. Any idea?
PHP: $_SESSION doesn't seem to get set. Any idea?
I got through this SO Q/A while searching why my session wouldn't get set.
On $_GET set $_SESSION won't work
I don't really get whether this applies to my case. Here it goes.
index.php
<?php
session_start();
if (!isset($_SESSION["authenticated"])) $_SESSION["authenticated"] = false;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
...
Then, I call the following when the user authenticates himself.
authenticate.php
<?php
require_once "data/data_access.php";
$userName = "";
$password = "";
if (isset($_REQUEST["userName"])) $userName = $_REQUEST["userName"];
if (isset($_REQUEST["password"])) $password = $_REQUEST["password"];
$isAuthentic = isAuthenticUser($userName, $password);
$_SESSION["authenticated"] = $isAuthentic;
echo $isAuthentic;
?>
I also have this authentication-thing checked every 5 seconds in order to
create the buttons for the section the user is in.
authenticated.php
<?php echo isset($_SESSION["authenticated"]) && $_SESSION != false ?
'true' : 'false'; ?>
and my Ajax call setup:
my_project.js
$(document).ready(function() { startAuthenticationChecking(); });
function startAuthenticationChecking() {
setInterval(function() { ajaxSession("authenticated.php"); }, 5000);
}
function ajaxSession(actionURL) {
var authenticated = false;
$.ajax({
async: false,
url: actionURL,
success: function(authenticated) {
alert(authenticated);
if (authenticated) {
if (("#addNewAtvButtonDiv").is(":empty"))
$("#addNewAtvButtonDiv").add("<button
id='newAtvButton'>Inscrire un nouveau VTT en
inventaire</button>");
if (("#addNewSledButtonDiv").is(":empty"))
$("#addNewSledButtonDiv").add("<button
id='newSledButton'>Inscrire un nouvel UTT en
inventaire</button>");
if (("#addNewUtvButtonDiv").is(":empty"))
$("#addNewUtvButtonDiv").add("<button
id='newUtvButton'>Inscrire une nouvelle
motoneige</button>");
$("button").button();
} else {
$("#addNewAtvButtonDiv").children().remove();
$("#addNewSledButtonDiv").children().remove();
$("#addNewUtvButtonDiv").children().remove();
}
}
});
}
My Problem
Though I set $_SESSION["authenticated"] = false right after the
session_start();, when the ajaxSession() asks whether a user is
authenticated through authenticated.php, it always returns 'false'. Event
after an authentication using authenticate.php with proper credentials.
Related question: PHP / Ajax : How to show/hide DIV on $_SESSION variable
value?
Any help welcome! I've been working on this for a few nights and days
lately, and still am.
Thanks!
I got through this SO Q/A while searching why my session wouldn't get set.
On $_GET set $_SESSION won't work
I don't really get whether this applies to my case. Here it goes.
index.php
<?php
session_start();
if (!isset($_SESSION["authenticated"])) $_SESSION["authenticated"] = false;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
...
Then, I call the following when the user authenticates himself.
authenticate.php
<?php
require_once "data/data_access.php";
$userName = "";
$password = "";
if (isset($_REQUEST["userName"])) $userName = $_REQUEST["userName"];
if (isset($_REQUEST["password"])) $password = $_REQUEST["password"];
$isAuthentic = isAuthenticUser($userName, $password);
$_SESSION["authenticated"] = $isAuthentic;
echo $isAuthentic;
?>
I also have this authentication-thing checked every 5 seconds in order to
create the buttons for the section the user is in.
authenticated.php
<?php echo isset($_SESSION["authenticated"]) && $_SESSION != false ?
'true' : 'false'; ?>
and my Ajax call setup:
my_project.js
$(document).ready(function() { startAuthenticationChecking(); });
function startAuthenticationChecking() {
setInterval(function() { ajaxSession("authenticated.php"); }, 5000);
}
function ajaxSession(actionURL) {
var authenticated = false;
$.ajax({
async: false,
url: actionURL,
success: function(authenticated) {
alert(authenticated);
if (authenticated) {
if (("#addNewAtvButtonDiv").is(":empty"))
$("#addNewAtvButtonDiv").add("<button
id='newAtvButton'>Inscrire un nouveau VTT en
inventaire</button>");
if (("#addNewSledButtonDiv").is(":empty"))
$("#addNewSledButtonDiv").add("<button
id='newSledButton'>Inscrire un nouvel UTT en
inventaire</button>");
if (("#addNewUtvButtonDiv").is(":empty"))
$("#addNewUtvButtonDiv").add("<button
id='newUtvButton'>Inscrire une nouvelle
motoneige</button>");
$("button").button();
} else {
$("#addNewAtvButtonDiv").children().remove();
$("#addNewSledButtonDiv").children().remove();
$("#addNewUtvButtonDiv").children().remove();
}
}
});
}
My Problem
Though I set $_SESSION["authenticated"] = false right after the
session_start();, when the ajaxSession() asks whether a user is
authenticated through authenticated.php, it always returns 'false'. Event
after an authentication using authenticate.php with proper credentials.
Related question: PHP / Ajax : How to show/hide DIV on $_SESSION variable
value?
Any help welcome! I've been working on this for a few nights and days
lately, and still am.
Thanks!
Prevent timer from stopping when window is inactive Javascript
Prevent timer from stopping when window is inactive Javascript
Helllo, I'm making a quiz application, and want to set a timer. I want to
make it in Javascript. This is my function:
function countDown(sec, elem) {
_(elem).innerHTML = sec;
if(sec < 1) {
clearTimeout(timer);
endGame ();
return;
}
sec--;
var timer = setTimeout('countDown('+sec+',"'+elem+'")',1000);
}
The problem is that, for example, for mobile Saffari browser, when you
hold your finger on the screen (like scrolling effect), the timer stops,
yet you can still see the questions... So, basically, you can have an
unlimited time. How can I make the timer to run nomatter what?
Thank you in advance!
Helllo, I'm making a quiz application, and want to set a timer. I want to
make it in Javascript. This is my function:
function countDown(sec, elem) {
_(elem).innerHTML = sec;
if(sec < 1) {
clearTimeout(timer);
endGame ();
return;
}
sec--;
var timer = setTimeout('countDown('+sec+',"'+elem+'")',1000);
}
The problem is that, for example, for mobile Saffari browser, when you
hold your finger on the screen (like scrolling effect), the timer stops,
yet you can still see the questions... So, basically, you can have an
unlimited time. How can I make the timer to run nomatter what?
Thank you in advance!
Java: turning an arraylist into an array with an added element
Java: turning an arraylist into an array with an added element
I know that the code to turn an arraylist into an array is:
private String[] arrayLst_to_array(ArrayList<String> al) {
String[] arr = new String[al.size()];
arr = al.toArray(arr);
return arr;
}
But I want my new array to have a certain string in the beginning and then
after that, I want the rest of the arraylist.
I know that I could just add the string that I want to the beginning of
the arraylist and then convert it, but is there a more efficient way?
I know that the code to turn an arraylist into an array is:
private String[] arrayLst_to_array(ArrayList<String> al) {
String[] arr = new String[al.size()];
arr = al.toArray(arr);
return arr;
}
But I want my new array to have a certain string in the beginning and then
after that, I want the rest of the arraylist.
I know that I could just add the string that I want to the beginning of
the arraylist and then convert it, but is there a more efficient way?
Is call to preventDefault() really necessary on drop event?
Is call to preventDefault() really necessary on drop event?
I am learning about Drag & Drop. I have copied a W3Schools example in
JSFiddle.
The W3School example calls preventDefault() in the drop event:
function drop(ev) {
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
Yet, I don't understand the need when reading documentation. When I remove
this call, the example still works fine:
function drop(ev) {
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
So, what is the use of this call to preventDefault()? Do I really need it?
If yes why?
I am learning about Drag & Drop. I have copied a W3Schools example in
JSFiddle.
The W3School example calls preventDefault() in the drop event:
function drop(ev) {
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
Yet, I don't understand the need when reading documentation. When I remove
this call, the example still works fine:
function drop(ev) {
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
So, what is the use of this call to preventDefault()? Do I really need it?
If yes why?
Tuesday, 1 October 2013
disable edit script button in menu sl4a
disable edit script button in menu sl4a
is there some way of hidden or disabbling (graying may be) edit button in
menu of sl4a?
the button in question is that appear when tap or click a name script in
the script list of the sl4a
other: Can I configure these buttons caption and actions?
is there some way of hidden or disabbling (graying may be) edit button in
menu of sl4a?
the button in question is that appear when tap or click a name script in
the script list of the sl4a
other: Can I configure these buttons caption and actions?
Visibility Expression regarding data value
Visibility Expression regarding data value
I have a table with 4 columns: AKA, Value, Unit, and Metric.
I have a filter on the dataset on AKA based on a parameter. I am trying to
use the following in the visibility filter:
=IIF(Fields!Metric.Value, "MONTHLY_SummaryStats" = "Availablility", FALSE,
TRUE)
I am getting an error regarding the expression referring directly to a
field without a dataset aggregate.
Any idea why it's asking for an aggregate when I am trying to filter on a
specific value?
Based on the filter on the dataset, this expression should only return 1
value.
I have a table with 4 columns: AKA, Value, Unit, and Metric.
I have a filter on the dataset on AKA based on a parameter. I am trying to
use the following in the visibility filter:
=IIF(Fields!Metric.Value, "MONTHLY_SummaryStats" = "Availablility", FALSE,
TRUE)
I am getting an error regarding the expression referring directly to a
field without a dataset aggregate.
Any idea why it's asking for an aggregate when I am trying to filter on a
specific value?
Based on the filter on the dataset, this expression should only return 1
value.
Apache and PHP interaction
Apache and PHP interaction
Suppose we have a typical LAMP setup. When a person requests a web page
coded in php, what happens at the Apache level? Does Apache create a new
php instance to create and return that web page? Or is there a continuous
php instance running at all times?
Basically, here is how I think it works:
Person visits http://example.com/index.php
Apache receives the request, spins up an instance of php to create the page
Page is created, sent back to the requesting browser
PHP instance is closed
Thus, only one php instance deals with page requests...Is my thinking
correct on this?
Suppose we have a typical LAMP setup. When a person requests a web page
coded in php, what happens at the Apache level? Does Apache create a new
php instance to create and return that web page? Or is there a continuous
php instance running at all times?
Basically, here is how I think it works:
Person visits http://example.com/index.php
Apache receives the request, spins up an instance of php to create the page
Page is created, sent back to the requesting browser
PHP instance is closed
Thus, only one php instance deals with page requests...Is my thinking
correct on this?
What are these localhosts accessing Apache virtualhost?
What are these localhosts accessing Apache virtualhost?
In my server-status page I see a lot of requests from localhost. what are
these for? are they actually doing anything?
201-0 - 0/0/327 . 0.94 28653 0 0.0 0.00 99.83 ::1
domain.com OPTIONS * HTTP/1.0
202-0 - 0/0/140 . 1.65 28333 0 0.0 0.00 52.80 ::1
domain.com OPTIONS * HTTP/1.0
203-0 - 0/0/359 . 3.15 28425 0 0.0 0.00 88.87 ::1
domain.com OPTIONS * HTTP/1.0
204-0 - 0/0/353 . 4.16 28861 0 0.0 0.00 150.89 ::1
domain.com OPTIONS * HTTP/1.0
205-0 - 0/0/382 . 0.18 28275 0 0.0 0.00 86.17 ::1
domain.com OPTIONS * HTTP/1.0
206-0 - 0/0/242 . 1.19 28586 0 0.0 0.00 119.88 ::1
domain.com OPTIONS * HTTP/1.0
207-0 - 0/0/260 . 1.06 28475 0 0.0 0.00 90.53 ::1
domain.com OPTIONS * HTTP/1.0
208-0 - 0/0/381 . 4.92 28644 0 0.0 0.00 57.20 ::1
domain.com OPTIONS * HTTP/1.0
209-0 - 0/0/172 . 0.81 28273 0 0.0 0.00 101.78 ::1
domain.com OPTIONS * HTTP/1.0
210-0 - 0/0/277 . 1.76 28695 0 0.0 0.00 70.73 ::1
domain.com OPTIONS * HTTP/1.0
211-0 - 0/0/776 . 6.57 20491 0 0.0 0.00 211.93 ::1
domain.com OPTIONS * HTTP/1.0
In my server-status page I see a lot of requests from localhost. what are
these for? are they actually doing anything?
201-0 - 0/0/327 . 0.94 28653 0 0.0 0.00 99.83 ::1
domain.com OPTIONS * HTTP/1.0
202-0 - 0/0/140 . 1.65 28333 0 0.0 0.00 52.80 ::1
domain.com OPTIONS * HTTP/1.0
203-0 - 0/0/359 . 3.15 28425 0 0.0 0.00 88.87 ::1
domain.com OPTIONS * HTTP/1.0
204-0 - 0/0/353 . 4.16 28861 0 0.0 0.00 150.89 ::1
domain.com OPTIONS * HTTP/1.0
205-0 - 0/0/382 . 0.18 28275 0 0.0 0.00 86.17 ::1
domain.com OPTIONS * HTTP/1.0
206-0 - 0/0/242 . 1.19 28586 0 0.0 0.00 119.88 ::1
domain.com OPTIONS * HTTP/1.0
207-0 - 0/0/260 . 1.06 28475 0 0.0 0.00 90.53 ::1
domain.com OPTIONS * HTTP/1.0
208-0 - 0/0/381 . 4.92 28644 0 0.0 0.00 57.20 ::1
domain.com OPTIONS * HTTP/1.0
209-0 - 0/0/172 . 0.81 28273 0 0.0 0.00 101.78 ::1
domain.com OPTIONS * HTTP/1.0
210-0 - 0/0/277 . 1.76 28695 0 0.0 0.00 70.73 ::1
domain.com OPTIONS * HTTP/1.0
211-0 - 0/0/776 . 6.57 20491 0 0.0 0.00 211.93 ::1
domain.com OPTIONS * HTTP/1.0
Subscribe to:
Comments (Atom)