我正在使用Asp.Net MVC开发一个Web项目,我将不得不将其部署到一个农场环境中.
我已经阅读了很多文章而且我正在考虑完全禁用SessionState,我认为这会使一个更强大的应用程序,并且会省去一些令人头疼的事情(我读过的所有内容都告诉我处理会话农场不是小事).
有些事情我仍然没有完全清楚这种方法,主要是认证/授权过程.基本上我不知道如果服务器上没有启用SessionState,我可以如何(如果?)处理用户会话.如果用户登录该网站然后尝试访问另一个页面,我怎么知道该用户已经登录?我知道使用cookie是不安全的,我想到了混合的cookie与存储在数据库中的会话ID,但我想如果我禁用SessionState,我也无法访问会话ID.
什么是最好的方法?有没有可以指向我的推荐书/文章,所以我可以明白这一点?
非常感谢你的帮助
XCode中的静态库和动态库有什么区别?为什么Apple不允许我们在iOS应用程序中使用动态库?
我有一个问题.我在C文件中定义了read-line.c,一个函数print,如下所示:
void history_print(void)
{
/* some stuff */
}
Run Code Online (Sandbox Code Playgroud)
在C++文件command.cc中,我有以下内容:
extern "C" void history_print(void);
Run Code Online (Sandbox Code Playgroud)
然后我只需调用history_print().
#Use GNU compiler
cc = gcc -g
CC = g++ -g
all: shell
tty-raw-mode.o: tty-raw-mode.c
gcc -c tty-raw-mode.c
read-line.o: read-line.c
gcc -c read-line.c
lex.yy.o: shell.l
lex shell.l
$(cc) -c lex.yy.c
y.tab.o: shell.y
yacc -d shell.y
$(CC) -c y.tab.c
command.o: command.cc
$(CC) -c command.cc
shell: y.tab.o lex.yy.o tty-raw-mode.o read-line.o command.o
$(CC) -o shell lex.yy.o y.tab.o tty-raw-mode.o read-line.o command.o -ll -lgen
Run Code Online (Sandbox Code Playgroud)
在我的Makefile中链接规则输出时遇到问题:
Undefined first referenced
symbol in …Run Code Online (Sandbox Code Playgroud) 情况1:
-(id)getAnObject{
Object *someObject = [[Object alloc] init];
//doing something
return someObject;
}
Run Code Online (Sandbox Code Playgroud)
案例2:
-(void)dealWithAnObject{
Object *someObject = [[Object alloc] init];
[assignTheObjectToOther someObject];
}
Run Code Online (Sandbox Code Playgroud)
案例1和案例2都在XCode中有一些警告,我该怎么做才能处理这两个问题?谢谢.
我对这3个术语完全感到困惑,何时使用哪个?什么是关系,他们是谁控制的孩子?
说这是树是否正确:
ItemsControl> ItemsPresenter> ItemsPanel
我有一个如下所示的Command类:
public class Command {
...
private String commandName;
private Object[] commandArgs;
...
public void executeCommand() {}
}
Run Code Online (Sandbox Code Playgroud)
我还有一个Command,AuthenticateCommand的子类:
public class AuthenticateCommand extends Command {
...
@Override
public void executeCommand() {
...
}
}
Run Code Online (Sandbox Code Playgroud)
现在假设一个类Server,它有一个方法processCommand(命令命令).它接受命令param,检查commandName字段,并使用该名称将命令强制转换为Command的子类,负责实现命令逻辑.在此示例中,您可能拥有一个CommandName,其commandName为"authenticate",而command和pw存储在commandArgs数组中.processCommand()会将Command强制转换为AutheticateCommand并调用executeCommand()方法.我试图用以下内容完成此任务(commandMap只是一个将commandName映射到其实现者类名的Map):
public void processCommand(Command command) {
String commandName = command.getCommandName();
String implementorClassString = commandMap.get(commandName);
try {
Class implementorClass = Class.forName(implementorClassString);
Object implementor = implementorClass.cast(command);
Method method = implementorClass.getDeclaredMethod("executeCommand", null);
method.invoke(implementor);
} catch (ClassNotFoundException e) {
logger.error("Could not find implementor class: " + implementorClassString, e);
} catch …Run Code Online (Sandbox Code Playgroud) 有24个div对象等待/侦听鼠标单击.单击一个div对象后,我想EventListener从所有24个div对象中删除它.
for (var i=1;i<=24;i++){
document.getElementById('div'+i).addEventListener('click',function(event){
for (var z=1;z<=24;z++){
document.getElementById('div'+z).removeEventListener()//Problem lies here
}
//Some other code to be run after mouseclick
},false);
}
Run Code Online (Sandbox Code Playgroud)
问题是removeEventListener嵌套在addEventListener,我需要将类型,监听器,标题定义为removeEventListener方法的属性.而且我认为由于嵌套而无法定义监听器.
我也尝试定义一个函数名,但它没有用:
for (var i=1;i<=24;i++){
document.getElementById('div'+i).addEventListener('click',function helpme(event){
for (var z=1;z<=24;z++){
document.getElementById('div'+z).removeEventListener('click',helpme,false);
}
//Some other code to be run after mouseclick
},false);
}
Run Code Online (Sandbox Code Playgroud) 我想动态解析一个对象树来做一些自定义验证.验证并不重要,但我想更好地理解PropertyInfo类.
我会做这样的事情,
public bool ValidateData(object data)
{
foreach (PropertyInfo propertyInfo in data.GetType().GetProperties())
{
if (the property is a string)
{
string value = propertyInfo.GetValue(data, null);
if value is not OK
{
return false;
}
}
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
我现在关心的唯一部分是'如果属性是字符串'.如何从PropertyInfo对象中找出它的类型.
我将不得不处理基本的东西,如字符串,整数,双打.但我也必须处理对象,如果是这样,我将需要在对象树中进一步向下遍历这些对象以验证其中的基本数据,它们也将具有字符串等.
谢谢.
据我所知,Java线程可以使用一些线程API进行通信.但我想知道Java线程和OS线程是如何相互通信的.例如,Java线程需要等待某个OS线程完成其执行并将一些结果返回给此Java线程并且它处理相同的内容.
我正在使用jQuery显示模式对话框.该对话框可以textarea控制它.但是在提交这个对话框时,由于textarea某种原因,jQuery无法识别它的值:它总是空白.这在其他浏览器中完美运行.我发出警告来显示值,但它看起来是空白的.在这方面有人可以帮助我吗?
控制:
<input type="text" id="txtGroupName"/>
<textarea rows="3" cols="30" id="txtDescription"></textarea>
Run Code Online (Sandbox Code Playgroud)
使用此值的jQuery代码:
var postData = new Object();
postData.GroupName = $('#txtGroupName').val();
postData.Description = $('#txtDescription').val();
Run Code Online (Sandbox Code Playgroud)
$('#txtDescription').val()来是空白但$('#txtGroupName').val()正确读取,因为它是一个输入字段.
关于这个问题的另一个发现:
当我在页面加载时填充控件值后在我的更新函数中放置警报时,此警报会正确显示现有值.但它只显示现有价值.提交模式框后,它不会显示已编辑的值.
iphone ×2
java ×2
reflection ×2
.net ×1
asp.net ×1
asp.net-mvc ×1
c ×1
c# ×1
c++ ×1
casting ×1
ios ×1
itemscontrol ×1
itemspanel ×1
javascript ×1
jquery ×1
linker ×1
makefile ×1
objective-c ×1
opera ×1
session ×1
silverlight ×1
web-farm ×1
xaml ×1
xcode ×1