session-variables

What can be the maximum size for the $_SESSION?

ぃ、小莉子 提交于 2019-11-28 08:20:42
问题 I am importing a csv file with more then 5,000 records in it. What i am currently doing is, getting all file content as an array and saving them to the database one by one. But in case of script failure, the whole process will run again and if i start checking the them again one by one form database it will use lots of queries, so i thought to keep the imported values in session temporarily. Is it good practice to keep that much of records in the session. Or is there any other way to do this

ASP.NET removing an item from Session?

这一生的挚爱 提交于 2019-11-28 05:38:37
Which method is preferred? Session.Remove("foo"); Session["foo"] = null; Is there a difference? Buu Nguyen Is there a difference? There is. Session.Remove(key) deletes the entry (both key & value) from the dictionary while Session[key] = null assigns a value (which happens to be null) to a key. After the former call, the key won't appear in the Session#Keys collection. But after the latter, the key can still be found in the key collection. I know this is old thread but definitely stick with Session["key"] = null - it's much more faster! I've done some tests (on InProc Session State), removing

mocking session variable in unit test using Moles

不想你离开。 提交于 2019-11-28 05:33:35
问题 Method I am unit testing checks for a session variable like if(Session["somevar"] != null) { // rest of the code } In my test, not able to get rid of this since Session is null, it's throwing null referrence exception. To bypass this, I have tried mocking it like below but no luck System.Web.Moles.MHttpContext.AllInstances.SessionGet = (HttpContext cntx) => { return (HttpSessionState)cntx.Session["somevar"]; } I even tried method mention here to simulate HttpContext and then doing below

Dynamic MySQL with local variables

心已入冬 提交于 2019-11-28 05:31:17
问题 How can I use dynamic SQL statements in MySQL database and without using session variables? Right now I have such a code (in MySQL stored procedure): (...) DECLARE TableName VARCHAR(32); SET @SelectedId = NULL; SET @s := CONCAT("SELECT Id INTO @SelectedId FROM ", TableName, " WHERE param=val LIMIT 1"); PREPARE stmt FROM @s; EXECUTE stmt; DEALLOCATE PREPARE stmt; IF ISNULL(@SelectedId) THEN (...) But I'd like to use only local variables, that means I'd like to start this procedure with:

Are Laravel 4 session variables secure?

耗尽温柔 提交于 2019-11-28 05:29:42
问题 Is there any (known) way for end users to edit a Laravel 4 session variable? 回答1: Is there any (known) way for end users to edit a Laravel 4 session variable? Yes there is, but only if you go out of your way to make it possible. The steps required are: Use the cookie driver for sessions (which stores all session data into a cookie rather than simply storing an identifier in the cookie and keeping the actual data server-side). I generally recommend against storing session state in a cookie.

Google App Engine - Getting Sessions working with Python 2.7

我与影子孤独终老i 提交于 2019-11-28 05:07:32
First of all, I'm brand new to GAE, so its possible I'm doing this the wrong way - but I've used PHP before and session was how I kept persistent data. I'm using Python 2.7 because that is what I use for all my other Python development - although I'm beginning to wonder if downgrading to 2.5 might be a valid solution, if not an ideal one. The scenario is that I'm building a proof-of-concept site, and I need to have a 'dummy' login button that simply sets a session variable called 'user' with a value of 'admin' . I then want to check in the navigation template to see if the variable is set, and

Saving data to session in JSF

£可爱£侵袭症+ 提交于 2019-11-28 04:23:47
I am new to the world of J(2)EE and web app development but am quickly navigating my way around it and learning a lot. Every day is a fantastic voyage of new discovery for me. I am currently working on a project in which I am using Visual JSF Woodstock on Glassfish v2. I am pretty new to JSF also. There are times when I need to save some objects (say MyObject for instance) between requests. And from what I have read and understood so far, I need to be using sessions to save these objects between different requests. So far so good. Exactly how to do this is where my concern lies. I know that in

HTTPSession variable limit

半城伤御伤魂 提交于 2019-11-28 04:23:18
问题 What is the maximum limit (i.e. size) of data that a HTTPSession variable can hold? What will happen if this exceeds? And most importantly, what is the alternative approach to have the data throughout the session if the size exceeds the maximum size that a HTTPSession variable can hold? 回答1: There is no limit, other than the memory of your server. The alternatives are to run your server with more memory to configure the server to swap sessions to disk (see http://tomcat.apache.org/tomcat-7.0

MySQL wait_timeout Variable - GLOBAL vs SESSION

微笑、不失礼 提交于 2019-11-28 03:47:46
SHOW VARIABLES LIKE "%wait%" Result: 28800 SET @@GLOBAL.wait_timeout=300 SHOW GLOBAL VARIABLES LIKE "%wait%" Result: 300 SHOW SESSION VARIABLES LIKE "%wait%" Result:28800 I am confused by the results. Why does the last query give Result:28800 ? Your session status are set once you start a session, and by default, take the current GLOBAL value. If you disconnected after you did SET @@GLOBAL.wait_timeout=300 , then subsequently reconnected, you'd see SHOW SESSION VARIABLES LIKE "%wait%"; Result: 300 Similarly, at any time, if you did mysql> SET session wait_timeout=300; You'd get mysql> SHOW

Is there a best practice and recommended alternative to Session variables in MVC

梦想与她 提交于 2019-11-28 03:40:00
Okay, so first off before anyone attempts to make a determination that this is a "duplicate" question; I have reviewed most of the posts on SO regarding similar questions but even in combination of all that has been said I still am somewhat at a dilemma as to the definitive or maybe I should say unanimous agreement on this. I can however say that I have (based on the posts) conclusively determined that the answer is based on the scope of the requirement. But even with consideration of this, the opinions seem too diverse for me to make a decision as to how I should handle this. My immediate