|
I may be a tad late to the game here but if you are using Linux or Mac this should work fine for your needs.
--Terry Valladon
<code>
$random_number = rand(); // I will let you worry about seeds and stuff, perhaps call your own make_random() function?
print('Random number is '.$random_number."\n");
declare(ticks = 1); // Set ticks to one second
pcntl_signal(SIGALRM, "signal_handler"); // Installs a signal handler for SIGALARM (works in linux/mac only I think)
pcntl_alarm(1200); //trigger alarm in 20 min (60 seconds * 20 min = 1200 seconds)
// This is just to keep the script running forever, I would HOPE you would have real code in here rather then just looping endlessly.
for(;;)
{
sleep(1);
}
function signal_handler($signal)
{
global $random_number;
switch($signal)
{
case SIGALRM:
$random_number = rand(); // New random number, I will let you worry about seeds and stuff, perhaps call your own make_random() function?
print('New random number is '.$random_number."\n");
pcntl_alarm(1200); //trigger alarm again in 20 min
break; // Exit function and continue normal code execution.
}
}
</code>
|
|
|
|
|
Good Morning,
I am trying to write a simple time out javascript to accompany an ASP.net application. The default time out for the application is 20 minutes. Currently, when it does time out, it reverts to an ugly error page. I would rather that it either logs the user off or simply sends him to the login or index page. Although I have found some very seemingly simple samples, I cannot get anything to work. I do not know if it makes a difference, but I am using an internal (<Iframe>) to rotate pages within a main page. I do not why that should make a difference since the session value is based on the session and not the page. Either way, I have tried posting the script on both the Main page that displays the frame and on the inserted frame page as well. It makes no difference. These are the two scripts that I have tried:
Style 1 is supposed to give the option to take the user to a new page if it is not responded to:
function warnuser()
{
if (confirm("There has been no activity for some time.\nClick 'OK' if you " +
"wish to continue your session,\nor click 'Cancel' to log out.\nFor your " +
"security if you are unable to respond to this message\nwithin 2 minutes you " +
"will be logged out automatically."))
{
//post the page to itself
document.location.href = "Main.aspx"
}
else
{
document.location.href = "Index.aspx"
}
}
Style 2 is simpler and simply posts a warning:
function SessionAlert()
{
alert("Your Session will time out in 19 minutes");
}
setTimeOut("SessionAlert", 1 * 60 * 1000);
I tried setting the second one for just a minute just to see if it would work. It doesn't. Following is the setting that is deployed on the web.config page in the ASP.net applcation (and it does time out in 20 minutes):
<sessionState mode="InProc" cookieless="false" timeout="20" />
Any assistance is greatly appreciated....Pat
|
|
|
|
|
The following javascript will simply run in background and redirect the user whereever you want - (The '3000' value is in milliseconds.)
var t=setTimeout("document.location.href ='somewhereelse.aspx'",3000);
Note this method is client side and works on the users browser. Clients can sometimes turn off javascript.. server side maybe needed.
I won't go into the server side options here - too many! This codeproject article however is excellent for giving you a through introduction:
Beginners Introduction to State Management Techniques in ASP.NET[^]
I think where you're having problems is the iframe though. Your time condition needs to sit on either one or the other. In your case I would suggest the main page - the parent page to the iframe. Set a timer - client or server side here and the child iframe will have to inherit the command.
|
|
|
|
|
Hi All,
I have a web based application with Windows Authentication. I need to pass the user name of windows authenticated user to the web application say keep the username in session.
How is this possible any help would be great.
Thanks is Advance
Regards
|
|
|
|
|
Hi All,
I have a web based application with Windows Authentication. I need to pass the user name of windows authenticated user to the web application say keep the username in session.
How is this possible any help would be create.
Thanks is Advance
Regards
|
|
|
|
|
Hi,
In ASP.NET code, in Global.asax.vb file, Sub Session_start add the following lines:
If User.Identity.IsAuthenticated Then
Session("username") = User.Identity.Name
End If
Session("username") will keep the windows username in the session.
Rgds,
Saša
|
|
|
|
|
you can always get the current user details from the context object. No point storing them in a session variable.
As for passing the user name to the web app, how do you thing windows authentication works? It does it for you.
|
|
|
|
|
Hi all,
can we create our own home Page design in YahooHome Page. or any other web site to help us to host our own home...
|
|
|
|
|
shiva.kore wrote: can we create our own home Page design in YahooHome Page
Have you tried asking Yahoo? I would seem logical.
shiva.kore wrote: any other web site to help us to host our own home...
Have you tried google for "web site hosting" - there are millions of hits.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi,
I am planning to learn the following courses on my own.
* MS SharePoint
* MS Dynamics
Would you please provide any good reference URLs, CBTs and books for this?
Thank you..
Regards,
Karina.
|
|
|
|
|
Do you not think that starting at the Sharepoint web site, might be a good start?
|
|
|
|
|
Hi,
I cannot use any of the features (like intellinsense, auto tag creation, scripting, outline tags, switching between design and code) in my visual studio html pages (like .aspx, .ascx, .html ,etc.,.) in 2008. But in visual studio 2005 its perfect. I use svn (subversion) as my source control and am not sure that causes any issue. In short, i can open the page and work like notepad in visual studio)
P.N: when i select tools=>options=>html designer, it shows An error occured loading this property page.
For a better understanding, check out the url below a clear picture of my issue (since asp.net forum doesnot have the feature for picture uploading i am using another link for bringing out my issue.)
http://www.daniweb.com/forums/post1074392.html
Thanks in advance for the help.
Mouli
|
|
|
|
|
Has it ever worked in this installation of 2008? I just ask b/c I'm wondering if that's a feature of 2008.
modified on Wednesday, January 27, 2010 9:59 AM
|
|
|
|
|
hello every body .
i want to develop a virtual library on the web so I have 3 permision level on download accessing .
i want some body to view a pdf file but not alowed to download that.
how can I do this.
thanks a lot for your help.
|
|
|
|
|
That's a tough one b/c if they're able to view it they can download it as well.
modified on Wednesday, January 27, 2010 9:59 AM
|
|
|
|
|
|
I m using eBay Trading API
For XML link is
"http://developer.ebay.com/webservices/latest/ebaySvc.xsd"
and XML code to call some method of Api is as follows
Pls Guide me how to send Request and Read Respone in C#.NET code?
<?xml version="1.0" encoding="utf-8"?>
<GetCategoryInfoRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<CategoryID >-1</CategoryID>
<IncludeSelector >ChildCategories</IncludeSelector>
</GetCategoryInfoRequest>
and Response is
<?xml version="1.0" encoding="UTF-8"?>
<GetCategoryInfoResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2009-12-12T12:11:14.460Z</Timestamp>
<Ack>Success</Ack>
<Build>E643_CORE_BUNDLED_10284414_R1</Build>
<Version>643</Version>
<CategoryArray>
<Category>
<CategoryID>-1</CategoryID>
<CategoryLevel>0</CategoryLevel>
<CategoryName>Root</CategoryName>
<CategoryParentID>0</CategoryParentID>
<LeafCategory>false</LeafCategory>
</Category>
<CategoryCount>37</CategoryCount>
<UpdateTime>2009-06-15T14:51:30.000Z</UpdateTime>
<CategoryVersion>92</CategoryVersion>
</GetCategoryInfoResponse>
|
|
|
|
|
I m adding webreference of this webservice link in my C#Project
|
|
|
|
|
Hi,
I have been using asynchronous requests for a long time. so the response was processed in a callback function. I thought of not using async so i made synchronous requests. The reason is that i dont have to have two more lines for checking the status and the onreadystatechange....
my synchronous requests would be like this...
var jax = createAjax();
jax.open('POST',url,false);
jax.setRequestHeader('Content-Type: application/x-www-form-urlencoded');<br />
jax.send(parameters);<br />
alert(jax.responseText);
so from the code you can understand that there is no need of a callback function and if conditions to check ready state... ...
So there is no problem in the above code. The problem araises here...
if i press the F5 (refresh) key or do a page refresh when the process is waiting for the response i get an (NS ERROR - firefox ( i have not yet checked that in IE browsers) (javascript error) though the process completes successfully. why?
Do we have to check whether the page is navigating away while in synchronous operation and abort the request?
or what could be the reason for the error. This will not happen in async requests because that is also the reason for async...
so i give a sync request and before the response is received if i navigate away or reload the page i get the error.
???
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
dear Sir,
I am using Sage X3.
When you logged in, it loads a home page where there is a menu .
I had an issue in my Pc, I retore windows registry from last week.
Since there when I logged in my Sage X3 Application, I can not see this home page.
I thing that there is some where in windows where it is metioned the default path. There this home page address is not there.
I do not know if i am wrong, if not can you show me where to write in hard this page address.
Thanks
|
|
|
|
|
You would be better off contacting Sage, they will have some method of fixing this.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Sounds like an interesting problem. Contact that products support staff might be the best way to get help on this one.
modified on Wednesday, January 27, 2010 9:58 AM
|
|
|
|
|
If you are interested in getting started with Windows Azure in the United States, see Front Runner[^]. This program is a no-brainer if you want to get your cloud applications on to Azure in record time. Plus, the program helps you market your cloud applications.
You get FREE help fast tracking applications on to the cloud with FREE email and phone support.
For more information about this limited time offer, see USA Early Adopters: Check out Front Runner for Windows Azure[^].
Learn about Why Azure[^].
Sign up at Front Runner[^].
|
|
|
|
|
Microsoft announced the expansion of Azure to 41 Countries today, (more countries must be in the works)! Microsoft is seriously committed to Azure and they make the tools to move your .NET assets to Azure available for free (Visual Studio 2010 was also released today- Express Web is for Azure and it is free)! You can also join the Microsoft Front Runner Program for Azure for free to access one-on-one technical support by phone or e-mail from our developer experts, who can help get your applications in the cloud. Once your application is compatible, you'll get a range of marketing benefits to help you let your customers know that you're a Front Runner. Visit http://frontrunner.msdev.com/whyjoin/windowsazure.aspx to join Front Runner.
|
|
|
|
|
Anyone know what the Android Safari equivalent is for XSLTProcessor()? It just doesn't seem to like my current code which works on all the other browsers.
Tried Googling it, but too much crap came up.
Thanks!
|
|
|
|