小编vex*_*exe的帖子

Visual Studio 是否平滑 PageUp/PageDown?

我发现 Visual Studio(以及大多数编辑器)中 PageUp/PageDown 的问题在于它一次导航一个完整的页面,并且是立即完成的。多次执行此操作,您最终会忘记自己在代码中的位置,并且不知道自己来自哪里。

我的问题:

  • 有什么办法可以修改PageUp/PageDown以跳转半页吗?
  • 有什么方法可以让 PageUp/PageDown 滚动“平滑”而不是立即滚动?(想想莱普)

据我所知,这并不是现成的,而且我找不到任何插件可以做到这一点。

编辑:我在编程时使用鼠标。建议使用鼠标滚轮或“触摸屏”违背了留在主排的目的。

text-editor visual-studio

6
推荐指数
1
解决办法
358
查看次数

在尝试从内部Zip文件(另一个Zip中的Zip)获取流时,获取"无法将其作为Zip文件读取"异常

在C#中,我使用的是DotNetZip 我有一个名为"innerZip.zip"的zip包含一些数据,另一个名为"outerZip.zip"的zip包含innerZip.为什么我这样做?好吧,在设置密码时,密码实际上适用于添加到存档而不是整个存档的各个条目,通过使用这个内部/外部组合,我可以设置传递到整个内部zip,因为它是一个条目外面的.

问题是,代码说得比普通词更好:

ZipFile outerZip = ZipFile.Read("outerZip.zip");
outerZip.Password = "VeXe";
Stream innerStream = outerZip["innerZip.zip"].OpenReader();
ZipFile innerZip = ZipFile.Read(innerStream); // I'm getting the exception here.
innerZip["Songs\\IronMaiden"].Extract(tempLocation);
Run Code Online (Sandbox Code Playgroud)

为什么我得到那个例外?内部文件是一个zip文件,所以我不应该得到那个例外吗?有没有办法绕过这个或者我只需要从外部提取内部,然后访问它?

Thanx提前..

c# dotnetzip

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

访问路径......被拒绝

好吧,我已经看到了很多关于这件事的问题,但仍然没有人回答我的问题。事实上,我看到的每个问题都各不相同,访问这个问题似乎真的很困扰程序员。

请查看代码:

DirectoryInfo Dir1 = Directory.CreateDirectory(Desktop + "\\DIR1");
DirectoryInfo Dir2 = Directory.CreateDirectory(Desktop + "\\DIR2");
//* Lets Create a couple of SubDirs in DIR1
for (int i = 0; i < 5; i++)
{
  // this will create 5 SubDirs in DIR1, named Sub1, Sub2 ... Sub5.
  Dir1.CreateSubdirectory("Sub" + (i + 1).ToString()); 
  //* lets create 5 text files in each SubDir:
  for (int j = 0; j < 5; j++)
  {
    File.Create(Dir1.FullName + "\\Sub"+(i+1).ToString() + "\\text"+(j+1).ToString() + ".txt"); 
  }
}

//* …
Run Code Online (Sandbox Code Playgroud)

c# access-denied directory-permissions

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

无法卸载visual studio 2012 - 抛出异常?

我正在尝试卸载VS2012以安装VS2013 - 但在我从控制面板卸载它之前,我继续并删除了其他看似无关的组件,我从未使用过.主要是,我删除了所有SQL相关的东西,所有的ASP.NET东西,F#运行时,Async SKD和一些更多的东西 - 我从来没有使用过.加上我每次卸载VS那些组件仍然存在,烦人......我做了之后,并尝试卸载VS12旗舰版 - 我得到了一个例外!

在此输入图像描述

我点击了细节,得到了:

Problem signature:
  Problem Event Name:   VSSetup
  P1:   vs_ultimate
  P2:   11.0.50727.01
  P3:   11.0.50727
  P4:   Uninstall
  P5:   unknown
  P6:   Crash: Exception
  P7:   5174ddfb
  P8:   2bf
  P9:   25
  OS Version:   6.1.7601.2.1.0.256.1
  Locale ID:    1033

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt
Run Code Online (Sandbox Code Playgroud)

我尝试了很多方法,其他卸载程序(它们都运行相同的卸载程序,因此我得到同样的崩溃) - 我尝试启动安装介质,从带有args的cmd运行它/uninstall /force- 没有骰子......

我该如何卸载它?

PS:运行Windows 7 X64 Ultimate

谢谢你的帮助.

编辑:MS Crosslink

编辑:现在我删除了VS相关的所有东西 …

installation uninstall visual-studio windows-7 visual-studio-2012

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

vim 脚本函数定义中的尖号 (#) 是什么意思?

所以当我发现这个页面时,我正在寻找在 vimcript 中获取一些面向对象的东西的方法

例如:

   function gnat#Make () dict
      ...
      return
   endfunction gnat#Make
Run Code Online (Sandbox Code Playgroud)
  • “#”是什么意思?
  • 这是否与像这样明确结束函数有关?(通常是endfu[nction]没有函数名称的)

谢谢!

vim

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

这个sqrt近似内联汇编函数如何工作?

通过阅读3D游戏编程大师的技巧,我遇到了这种用内联汇编编写的排序函数:

inline float FastSqrt(float Value)
{
    float Result;

    _asm
    {
        mov eax, Value
        sub eax, 0x3F800000
        sar eax, 1
        add eax, 0x3F800000
        mov Result, eax
    }

    return(Result);
}
Run Code Online (Sandbox Code Playgroud)

它是实际平方根的近似值,但精度足以满足我的需要.

这实际上是如何工作的?这个神奇的0x3F800000价值是什么?我们如何通过减法,旋转和添加来实现平方根?

以下是它在C/C++代码中的外观:

inline float FastSqrt_C(float Value)
{
    float Result;

    long Magic = *((long *)&Value);
    Magic -= 0x3F800000;
    Magic >>= 1;
    Magic += 0x3F800000;
    Result = *((float *)&Magic);

    return(Result);
}
Run Code Online (Sandbox Code Playgroud)

optimization x86 assembly sar square-root

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

编辑DisableTaskMgr值时"无法写入注册表项"错误

我在更改DisableTaskMgr注册表中的值时遇到了困难.这是我到目前为止所做的尝试:

RegistryKey taskMgr = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("Policies");

string[] subKeys = taskMgr.GetSubKeyNames();
bool foundSystemKey = false;
foreach (string s in subKeys)
  if (s == "System")
  {
    foundSystemKey = true;
    break;
  }
if (!foundSystemKey)
{
  taskMgr = taskMgr.CreateSubKey("System"); 
// here is where I'm getting the exception even when I do OpenSubkey("Policies" , true)
}

taskMgr.OpenSubKey("System", true);
taskMgr.SetValue("DisableTaskMgr", 1); // 0 to enable, 1 to disable.
Run Code Online (Sandbox Code Playgroud)

我也试过以下,看到执行最后一行时抛出同样的错误:

RegistrySecurity myRegSecurity = taskMgr.GetAccessControl();
string User = System.Environment.UserName;
myRegSecurity.ResetAccessRule(new RegistryAccessRule(User, RegistryRights.FullControl , AccessControlType.Allow));
taskMgr.SetAccessControl(myRegSecurity); // right …
Run Code Online (Sandbox Code Playgroud)

c# registry acl

4
推荐指数
1
解决办法
1722
查看次数

检测泛型类型是否已打开?

我的程序集中有一堆常规,封闭和打开的类型.我有一个查询,我试图排除它的开放类型

class Foo { } // a regular type
class Bar<T, U> { } // an open type
class Moo : Bar<int, string> { } // a closed type

var types = Assembly.GetExecutingAssembly().GetTypes().Where(t => ???);
types.Foreach(t => ConsoleWriteLine(t.Name)); // should *not* output "Bar`2"
Run Code Online (Sandbox Code Playgroud)

在调试open类型的泛型参数时,我发现它们FullName是null(以及其他类似的东西DeclaringMethod) - 所以这可能是一种方式:

    bool IsOpenType(Type type)
    {
        if (!type.IsGenericType)
            return false;
        var args = type.GetGenericArguments();
        return args[0].FullName == null;
    }

    Console.WriteLine(IsOpenType(typeof(Bar<,>)));            // true
    Console.WriteLine(IsOpenType(typeof(Bar<int, string>)));  // false
Run Code Online (Sandbox Code Playgroud)

有没有内置的方法来知道类型是否打开?如果没有,有没有更好的方法呢?谢谢.

c# reflection generic-type-argument

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

不使用 if 语句递减一个值并返回到最大值?

递增并回零很容易:

i = (i + 1) % Max;
Run Code Online (Sandbox Code Playgroud)

但递减并不是那么简单。基本上,要递减并换行,您通常会找到如下代码:

i--;
if (i < 0)
   i = Max;
Run Code Online (Sandbox Code Playgroud)

如果不使用 if 语句,我们如何编写前面的代码呢?

我知道可能会涉及按位运算符。通常,当我遇到此类问题时,我会尝试提出一些包含两项 A 和 B 的方程,然后尝试找到这两项的实际值。例如:

i = A + B
Run Code Online (Sandbox Code Playgroud)

如果i在范围内]0, Max]那么我们会得到:

i = 0 + BB = i-1

否则如果i == 0

i = A + 0A = Max

同样我们可以写:

i = i == 0 ? Max : i - 1;
Run Code Online (Sandbox Code Playgroud)

如何在没有任何 if 或三元运算符的情况下编写前面的方程?我尝试了很多按位运算和不同的算术组合,但没有成功。

有任何想法吗?

c bit-manipulation bitwise-operators decrement

4
推荐指数
1
解决办法
1149
查看次数

在C#中,是一个声明为:int [] a = {numbers ...}; 在堆栈?

在C#中,当我声明一个这样的数组时:

int []a = {1, 2, 3, 4, 5}
Run Code Online (Sandbox Code Playgroud)

这是在堆栈中声明的吗?

据我所知,我应该这样做:

int []a = new int[5]{1, 2, 3, 4, 5};
Run Code Online (Sandbox Code Playgroud)

考虑到数组是引用类型.

c# memory heap stack

3
推荐指数
2
解决办法
167
查看次数