how to change session expired on elgg 1.11 - elgg

i have changed 2 to 1 hours, like that
public function getActionTokenTimeout() {
if (($timeout = _elgg_services()->config->get('action_token_timeout')) === null) {
// default to 2 hours
$timeout = 1;
}
$hour = 60 * 60;
return (int)((float)$timeout * $hour);
}
but still not working

It's a bad idea to edit core files like that, especially that you have exposed config option action_token_timeout to do that exact change. If you have it set somewhere else in the code, it will take precedence over default value you just changed. Check your settings for $CONFIG->action_token_timeout = 1 or similar.
Further read on what should you change and what not: http://learn.elgg.org/en/2.0/guides/dont-modify-core.html

Related

How to set the bookmarking (cmi.location) for SCORM 1.2?

I tried to bookmarking for flash SCORM 1.2 packages. I'm properly capturing the last visited data(cmi.loation, suspend data), but when I'm trying to reset the data for next launch, SCO is not relocating, it is starting from beginning.
And I set the hard coded values in LMSInitilization() function in javascript.
I used bellow code for setting the location variable to SCO.
// cmi data model storing object
var cmiobj = new Object();
function LMSInitialize(dummyString) {
// already initialized or already finished
if ((flagInitialized) || (flagFinished)) { return "false"; }
// set initialization flag
flagInitialized = true;
this.cmiobj["cmi.core.lesson_location"]="6";
this.cmiobj['cmi.core.lesson_status']='incomplete';
this.cmiobj['cmi.core.session_time']='00:00:50';
this.cmiobj['cmi.suspend_data']='FA1Enon ... ";
// return success value
return "true";
}
Hope you help.
You need to set cmi.core.exit to "suspend" too - otherwise it will not supply any of the old data for you to continue with next time.

.NET AWS SDK CreateInvalidation doesn't work

I am using this code to invalidate CloudFront Files using ASP.NET AWS SDK.
public bool InvalidateFiles(string[] arrayofpaths)
{
try
{
var client = AWSClientFactory.CreateAmazonCloudFrontClient(MY_AWS_ACCESS_KEY_ID, MY_AWS_SECRET_KEY);
CreateInvalidationResponse r = client.CreateInvalidation(new CreateInvalidationRequest
{
DistributionId = ConfigurationManager.AppSettings["DistributionId"],
InvalidationBatch = new InvalidationBatch
{
Paths = new Paths
{
Quantity = arrayofpaths.Length,
Items = arrayofpaths.ToList()
},
CallerReference = DateTime.Now.Ticks.ToString()
}
});
}
catch
{
return false;
}
return true;
}
I supplied a path like "/images/1.jpg" but it seems that the invalidation doesn't take place. I've waited half and hour and used hard refresh and cleared the cache and the image is the same. I've changed the image to look different so I can notice the difference if invalidation has occurred.
In the console I see that the invalidation took place, because I have the ID and in the status I see 'completed', but again, nothing changed in the image.
My question is how can I check that the invalidation takes place and make it work, it seems that I am missing something.
Also, is there an option to create is asynchronous, so I won't need to answer from Amazon.
Thanks.

What will happen to objects in the cache with a timespan(0,0,0) expiration?

Our application adds objects to the cache using the following
int cacheTimeout = 5; // Default 5 minute timeout
if(ConfigurationManager.AppSettings["CacheTimeout"] != null)
{
cacheTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CacheTimeout"].ToString());
}
_cache.Insert(Key, CacheItem, null, DateTime.MaxValue, new TimeSpan(0, cacheTimeout, 0));
Our manager is concerned about possible caching issues and wants to know, what happens if you insert an object with a 0 length time span.
I think the object will be immediately deleted. Right or wrong?
Answer is "Wrong".
When inserted into the cache with the absolute expiration set to NoAbsoluteExpiration and the sliding expiration set to new TimeSpan(0,0,0), the callback is not fired immediately. I didn't wait to see when it would fire, if ever - maybe it's 20 minutes, maybe it's never.
So changed the code to this:
int cacheTimeout = 5; // Default 5 minute timeout
if(ConfigurationManager.AppSettings["CacheTimeout"] != null)
{
cacheTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["CacheTimeout"].ToString());
}
TimeSpan expiration = cacheTimeout > 0 ? new TimeSpan(0,cacheTimeout,0) : new TimeSpan(0,0,1);
_cache.Insert(Key, CacheItem, null, System.Web.Caching.Cache.NoAbsoluteExpiration, expiration, CacheItemPriority.Default, OnUpdateCallback);
That way if we do have caching problems we can update web.config to set the cache time out to 0 and have a 1 second expiration.

Asp.Net Change a value from another page

Hi
I have 2 webpage in my asp.net project.
I defined a int value in second page.
i want to change int value from first page. How can I make this?
You can't change the variable directly. But you can use Session to achieve this.
In Page 1
Session["session-name"] = "5";
In Page 2
if (Session["session-name"] != null) // check the session if it is exist
{
int a;
try
{
a = int.Parse(Session["session-name"].ToString());
}
catch
{
a = 0; // you can set null too. Whatever you want
}
}
You likely want to use Session Variables. You can start learning here.

Flex 3 : Easy Deep Linking Question

I'm having a problem with deeplinking on my Flex 3 site. I want people to be able to link to different parts of the site. I also want to be able to type a url into the browser bar and be taken to a particular part of my site. Also, I need the default to open to #view=2.
I'm having problems setting the default #view=2. So, it's supposed to check the browser fragment to see whether its a valid section of the site. If it is then it should call parseUrl() and open that section of the site. So far, so good. The problem is how do I set the default to view=#2, if the loop doesn't find a valid view number?
Here's my code:
private function initBrowserManager(): void {
browserManager = BrowserManager.getInstance();
browserManager.addEventListener(BrowserChangeEvent.BROWSER_URL_CHANGE, parseUrl);
browserManager.init("","My Website");
if(browserManager.fragment != null){
for (var j:uint = 0; j < ComboBoxDP.length; j++){
if(browserManager.fragment == "view="+ComboBoxDP[j].series){
parseUrl();
break;
}
}
}
}
I've tried to add this line: else{browserManager.setFragment("view="+ 2); parseUrl();} everywhere I could think of, but no luck so far. I know that the answer will be really simple. Any suggestions?
Thank you.
-Laxmidi
I'm assuming some of the intent of the code, but I'd use a boolean:
var initialFragmentValid:Boolean = false;
if(browserManager.fragment != null){
for (var j:uint = 0; j < ComboBoxDP.length; j++){
if(browserManager.fragment == "view="+ComboBoxDP[j].series){
initialFragmentValid = true;
break;
}
}
}
if (!initialFragmentValid) {
// set the default
browserManager.setFragment("view=2");
}
// always parse initially because we'll have a fragment regardless
parseUrl();

Resources