Structure Saved in a Session Variable - casting

The ReportInfo is a structure. The structure works fine on one web page but I am trying to use it on another web-page. Here is where I saved the ReportInfo structure to the Session Variable
Session["ReportInfo"] = reportInfo;
On the other web-page, I re-created the Structure and then assign the session variable to it, like this...
reportInfo = (ReportInfo)(Session["ReportInfo"]);
I get the following run-time error:
System.InvalidCastException was unhandled by user code
Message="Specified cast is not valid."
Source="App_Web_-s8b_dtf"
How do I get the ReportInfo structure out of the Session variable to use again?

Have you checked the value of Session["ReportInfo"]? Perhaps it's null or some other unsavory value? Also, I assume reportInfo in the second page is of type ReportInfo?

Related

read values from external json data file in postman

In my external jsondata file, i have defined “external” : null and I am calling that attribute in my post request body as “external”:{{external}} but acutally the “null”” value is not called. In the request body the value shows as “external”:{{external}} instead of “external”: null. please help me
https://github.com/postmanlabs/postman-app-support/issues/9606
It looks like a issue have raised above ticket , but as a work around use the below line of code in your pre-request code:
data["external"]===null?pm.variables.set("external",null):undefined
Here we are setting the value to null explicitly to null in local variable scope

Can't get config value from Akka ActorSystem

When I print current config values using println(system.settings.config.root().values())
I got long list of values, cutted:
[SimpleConfigObject({"separator":":"}),
SimpleConfigObject({"home":"/usr/local/Cellar/typesafe-activator/1.3.10"}),
,
SimpleConfigObject({"country":{"format":"UA"},"dir":"/Users/sr/ScalaProjects/akka-http-test","home":"/Users/sr","language":"en","name":"sr"})]
I want to get value of "dir" key.
I try to do it like this:
system.settings.config.getValue("dir")
but got exception:
com.typesafe.config.ConfigException$Missing: No configuration setting
found for key 'dir'
How to get this key?
You might be missing accessing user before accessing dir.
system.settings.config.getConfig("user").getValue("dir")
Note that you are not printing the config keys when printing root().values(), therefore you cannot see the "user" key. You should be able to see the full config block by printing (e.g.)
println(system.settings.config.root().entrySet())

SAP user change

I am using VB Script to Access SAP web Services, the sap web service has a method called user change, there are 3 mandatory parameters username, password and passwordX.
Here username is string so I can assign value without any problem, password is a type of Bapipwd. Bapipwd is a structure and it has a member called Bapipwd. To access that from VB script I have to use
Bapipwd.Bapipwd = "Password".
But when I try to put the statement Bapipwd.Bapipwd = "password" it shows an error message that "Bapipwd doesnt have member called Bapipwd".
The passwordX also a structure in SAP with the name of Bapipwdx and it has a member "Bapipwd"
If I user Bapipwdx.Bapipwd="X" it is working fine. Because both the structure and it's member name is different. But Bapipwd.Bapipwd is not working and it gives "Bapipwd doestn't have member Bapipwd"
I suspect this is due to both the structure and its member has the same name. Kindly help me to access the structure.

the persisting records instructions in the guide don't work for me

I'm trying to use the instructions find here:
http://emberjs.com/guides/models/persisting-records/
My server receives the json well and creates a record which it then returns properly, but my onSuccess function doesn't get anything usable as a response. It gets this strange object which if I try to pass onto the next route like the instructions say, it errors out saying this:
Uncaught Error: Assertion Failed: The value that #each loops over must be an Array. You passed '' (wrapped in (generated articles.view controller))
Here is my code:
https://github.com/mgenev/Full-Stack-JS-Boilerplate/blob/master/public/ember/controllers/articles_controller.js
I appreciate any help.
It looks like your transitionToArticle function requires an argument but you're not passing in anything when you're calling it:
article.save().then(transitionToArticle).catch(failure);

django - session lifetime variable

For example, after a user login, I need to create a socket object that connect to a server and this socket object will be used in following operations of this user(I don't want to make a new connection in each user operation). But django's handler are all function so I have nowhere to put this socket object except use global dict.
I also try request.session['sock'] = socket_obj, but it report error: "expected string or Unicode object, NoneType found".
What is the typical way to do this in django?