我有这个代码:
private TreeNodeCollection treeCollection;
public Client(TcpClient c)
{
this.tcpClient = c;
this.tree = null;
this.treeCollection = new TreeNodeCollection();
this.treeCollection.Clear();
}
public void AddNode(string node)
{
this.treeCollection.Add(node);
}
Run Code Online (Sandbox Code Playgroud)
该this.treeCollection = new TreeNodeCollection();回报
The type 'System.Windows.Forms.TreeNodeCollection' has no constructors defined
Run Code Online (Sandbox Code Playgroud)
如果我删除这一行,我得到的treeCollection从未被分配,并且将始终为null ...
Field 'Client.treeCollection' is never assigned to, and will always have its default value null
Run Code Online (Sandbox Code Playgroud)
如何将treeCollection指定为新的TreeNodeCollection,以便我可以使用AddNode方法向其添加节点?
当我的UITableView为空时,我正在尝试放置一个自定义的空单元格.
我使用以下代码:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
int count = [self.fetchedResultsController fetchedObjects].count;
if (count == 0) {
return 1;
}
return count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = nil;
int count = [self.fetchedResultsController fetchedObjects].count;
if (count == 0) {
// return empty cell
cell = [self getEmptyCellOfTableView:tableView cellForRowAtIndexPath:indexPath];
} else {
cell = [self getMyQuestionCellOfTableView:tableView cellForRowAtIndexPath:indexPath];
}
return cell;
}
Run Code Online (Sandbox Code Playgroud)
FRC didChangeObject实现:
- (void)controller:(NSFetchedResultsController *)controller
didChangeObject:(id)anObject
atIndexPath:(NSIndexPath *)indexPath
forChangeType:(NSFetchedResultsChangeType)type
newIndexPath:(NSIndexPath *)newIndexPath
{
if …Run Code Online (Sandbox Code Playgroud) 我正在使用ASHX处理程序,我希望处理程序检查Session!= null.
if (context.Session["Username"] != null)
Run Code Online (Sandbox Code Playgroud)
我得到这个错误指向这一行:
System.NullReferenceException:未将对象引用设置为对象的实例.
有什么问题?
这是我的代码行:
StringBuilder myCompleteMessage = new StringBuilder();
myCompleteMessage.Capacity = Int32.MaxValue-1;
Run Code Online (Sandbox Code Playgroud)
尝试过:
myCompleteMessage.Capacity = myCompleteMessage.MaxCapacity-1;
Run Code Online (Sandbox Code Playgroud)
我在第2行得到例外.
Exception of type 'System.OutOfMemoryException' was thrown.
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
at System.Text.StringBuilder.set_Capacity(Int32 value)
at Orca.Server.HandleClientComm(Object newClient) in C:\Users\Dan\Documents\Visual Studio 2010\Projects\msig\Orca\Server.cs:line 100
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart(Object obj)
Run Code Online (Sandbox Code Playgroud) 我有这个清单:
['192', '168', '0', '1', '80', '192', '168', '0', '2', '8080']...
Run Code Online (Sandbox Code Playgroud)
我想得到这个清单:
['192.168.0.1:80', '192.168.0.2:8080']...
Run Code Online (Sandbox Code Playgroud)
这样做的最佳方式是什么?
使用range与list流行?
用list切片?
我使用以下内容:
"dependencies": {
"express": "^4.0.0",
"socket.io": "0.9.16",
"mongoose": "^3.8.8",
"passport": "^0.2.0",
"passport-local": "^1.0.0",
"express-session": "^1.0.3",
"cookie-parser": "^1.0.1",
"body-parser": "^1.0.2",
"session-mongoose": "git://github.com/danpe/session-mongoose.git#master",
"passport.socketio": "^3.0.1"
}
Run Code Online (Sandbox Code Playgroud)
设置我的socket.io授权:
io.set("authorization", passportSocketIo.authorize({
passport : passport,
cookieParser: cookieParser(),
key: settings.sessionKey, //the cookie where express (or connect) stores its session id.
secret: settings.sessionSecret, //the session secret to parse the cookie
store: sessionStore, //the session store that express uses
fail: function(data, accept) {
console.log("failed");
// console.log(data);// *optional* callbacks on success or fail
accept(null, false); // second param takes …Run Code Online (Sandbox Code Playgroud) 我有这个问题:
SELECT Auctions.ID
FROM Auctions
INNER JOIN Products ON Auctions.ProductID = Products.ID
Run Code Online (Sandbox Code Playgroud)
据我所知,如果我有拍卖:
ID | ProductID
1 | 12
Run Code Online (Sandbox Code Playgroud)
并且ProductID 12不在Products表中,因此不会选择该行.
如果我是对的,我想删除Products表上没有找到产品ID的所有行.(无法找到JOIN的产品)
我怎样才能做到这一点?
可能重复:
从线程返回值?
我有这个代码:
//Asynchronously start the Thread to process the Execute command request.
Thread objThread = new Thread(new ParameterizedThreadStart(ExecuteCommandSync));
//Make the thread as background thread.
objThread.IsBackground = true;
//Set the Priority of the thread.
objThread.Priority = ThreadPriority.AboveNormal;
//Start the thread.
objThread.Start(command);
Run Code Online (Sandbox Code Playgroud)
问题是ExecuteCommandSync返回一个字符串.
如何捕获返回的字符串并将其返回?
我有以下代码:
public static void Next()
{
Process[] processes = Process.GetProcessesByName("test");
foreach (Process proc in processes)
PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_RIGHT, 0);
}
Run Code Online (Sandbox Code Playgroud)
此代码发送了向右箭头键,我想发送ALT + CTRL + RIGHT,我尝试了以下操作:
public static void Forward()
{
Process[] processes = Process.GetProcessesByName("test");
foreach (Process proc in processes)
{
PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_CONTROL, 0);
PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_ALT, 0);
PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_RIGHT, 0);
}
}
Run Code Online (Sandbox Code Playgroud)
但这行不通...
有任何想法吗?
我在使用RVM的Ubuntu 12.04,Ruby 1.9.3,Rails 3.2.8.
昨天我用Capistrano就好了,我重新启动了我的ubuntu,现在我正在尝试使用capistrano部署我得到这个:
$ cap deploy
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- rvm/capistrano (LoadError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:152:in `require'
from ./config/deploy.rb:4:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:89:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `each'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `load'
from Capfile:5:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:89:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `each'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/configuration/loading.rb:86:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/cli/execute.rb:65:in `each'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /var/lib/gems/1.8/gems/capistrano-2.13.4/lib/capistrano/cli/execute.rb:31:in `execute!'
from …Run Code Online (Sandbox Code Playgroud) c# ×5
.net ×4
ashx ×1
capistrano ×1
collections ×1
core-data ×1
exception ×1
express ×1
gem ×1
handler ×1
inner-join ×1
ios ×1
ip ×1
list ×1
memory ×1
node.js ×1
null ×1
objective-c ×1
passport.js ×1
postmessage ×1
process ×1
python ×1
return-value ×1
ruby ×1
rvm ×1
select ×1
socket.io ×1
sql ×1
sql-server ×1
string ×1
treenode ×1
treeview ×1
uitableview ×1
winapi ×1