问题列表 - 第36313页

当emacs启动时,如何终止*GNU Emacs*缓冲区?

可能重复:
无法隐藏Emacs中的欢迎屏幕

有没有办法可以防止在emacs启动时GNU Emacs缓冲区出现?

emacs

4
推荐指数
2
解决办法
7316
查看次数

防止某些属性更新?

在rails中,更新模型时,如何在使用以下调用时阻止更新模型的某些属性:

@user.update_profile params[:user]
Run Code Online (Sandbox Code Playgroud)

由于任何人都可以使用"密码"这样的名称创建表单输入,如何过滤允许更新的属性集?

这是attr_XXX的用途吗?

security ruby-on-rails

5
推荐指数
1
解决办法
811
查看次数

如何禁用ASP.NET渲染默认的html标签?

出于某种原因,我必须制作一个aspx页面让iphone/android到Post表单.在request.form的数据处理之后,我以纯文本形式响应了一个JSON字符串.但是*.aspx会强制渲染html,head,body标签,那么如何禁用它呢?

我不能使用ashx,因为手机必须通过表格发布图像,因为我通过谷歌搜索答案,ashx无法处理http帖子文件.

编辑:正如SLaks所说,ashx可以使用"context.Request.Files"处理POST文件并且它可以工作.

asp.net

0
推荐指数
1
解决办法
438
查看次数

VB.net在控件中调用属性更改

很多关于如何调用方法的例子,但是如何改变一个简单的属性?

为了演示,这里有一组非常简单的代码应该有所帮助.假设我需要从子表单设置visible属性,因此需要调用它:

Friend Sub activateItem(ByVal myItem As PictureBox)

    If myItem.InvokeRequired = True Then
        ????
    Else
        myItem.Visible = True
    End If

End Sub
Run Code Online (Sandbox Code Playgroud)

谢谢

vb.net properties invoke invokerequired

2
推荐指数
1
解决办法
7442
查看次数

替换realloc(C - > C++)

在之前的一个问题中,我询问了类型转换指针,但是针对使用C++分配系统而不是mallocs的更好解决方案.(我正在将一些C代码转换为C++)

但是,我仍然遇到类似功能的问题:

我变了:

tmp = malloc(sizeof(char*) * mtmp); --> tmp = new char*[mtmp];
Run Code Online (Sandbox Code Playgroud)

free(tmp) --> delete [] tmp;
Run Code Online (Sandbox Code Playgroud)

但是,我在以下函数中如何处理realloc:

char* space_getRndPlanet (void)
{
   int i,j;
   char **tmp;
   int ntmp;
   int mtmp;
   char *res;

   ntmp = 0;
   mtmp = CHUNK_SIZE;
   //tmp = malloc(sizeof(char*) * mtmp); <-- replaced with line below
   tmp = new char*[mtmp];
   for (i=0; i<systems_nstack; i++)
      for (j=0; j<systems_stack[i].nplanets; j++) {
         if(systems_stack[i].planets[j]->real == ASSET_REAL) {
            ntmp++;
            if (ntmp > mtmp) { /* need more space */
               mtmp += …
Run Code Online (Sandbox Code Playgroud)

c c++ void-pointers realloc

11
推荐指数
3
解决办法
9703
查看次数

iphone ios在单独的线程中运行

在单独的线程上运行代码的最佳方法是什么?是吗:

[NSThread detachNewThreadSelector: @selector(doStuff) toTarget:self withObject:NULL];
Run Code Online (Sandbox Code Playgroud)

要么:

    NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self
                                                                        selector:@selector(doStuff:)
                                                                          object:nil;
[queue addOperation:operation];
[operation release];
[queue release];
Run Code Online (Sandbox Code Playgroud)

我一直在做第二种方式,但我读过的Wesley Cookbook使用的是第一种方式.

iphone multithreading thread-safety ios

96
推荐指数
1
解决办法
7万
查看次数

iPad popover presentpopoverfrombarbuttonitem

我在导航栏的右侧添加了几个按钮,其中包含以下内容:

UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
customView.backgroundColor = [UIColor clearColor];

UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0,  0, 45, 44);
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
button.backgroundColor = [UIColor clearColor];
[button setImage:[UIImage imageNamed:@"toc.png"] forState:UIControlStateNormal];
button.userInteractionEnabled = YES;
[button addTarget:self action:@selector(tableOfContentsAction) forControlEvents:UIControlEventTouchUpInside];
[customView addSubview:button];

button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(50, 0, 45, 44);
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
button.backgroundColor = [UIColor clearColor];
[button setImage:[UIImage imageNamed:@"bookmark.png"] forState:UIControlStateNormal];
button.userInteractionEnabled = YES;
[button addTarget:self action:@selector(bookmarkButtonAction) forControlEvents:UIControlEventTouchUpInside];
[customView …
Run Code Online (Sandbox Code Playgroud)

popover ipad ios

4
推荐指数
2
解决办法
7309
查看次数

从网址中删除文件扩展名

我从来没有使用过mod_rewrite但是我想删除网站上我的网址的所有文件扩展名.我需要这样做的规则是什么?

我试过这个,但每次点击我网站上的链接时都会出现内部错误

RewriteRule ^(.*)$ $1.php [L]
Run Code Online (Sandbox Code Playgroud)

apache mod-rewrite url-rewriting

2
推荐指数
1
解决办法
1626
查看次数

实现hashCode()的首选方法是什么?

有时我需要通过组合其几个实例成员的hashCodes来实现obj的hashCode()方法.例如,如果组合obj有成员a,b和c,我经常看到ppl将其实现为


int hashCode(){
   return 31 * 31 * a.hashCode() + 31 * b.hashCode() + c.hashCode();
}
Run Code Online (Sandbox Code Playgroud)

这个神奇的数字31来自哪里?它是4字节的长度还是只是素数?

有没有其他优选/标准的方法来实现hashCode()?

java hashcode

8
推荐指数
2
解决办法
2426
查看次数

番石榴:设置<K> +功能<K,V> =地图<K,V>?

是否有一种惯用的方式来获取a Set<K>和a Function<K,V>,并获得Map<K,V>实时视图?(即MapSetFunction组合支持,如果例如添加了元素Set,则相应的条目也存在于Map)中.

(Collections2.filter有关实时视图的更多讨论,请参阅


如果不需要实时视图怎么办?有没有比这更好的东西:

public static <K,V> Map<K,V> newMapFrom(Set<K> keys, Function<? super K,V> f) {
    Map<K,V> map = Maps.newHashMap();
    for (K k : keys) {
        map.put(k, f.apply(k));
    }
    return map;
}
Run Code Online (Sandbox Code Playgroud)

java collections guava

33
推荐指数
4
解决办法
6854
查看次数