问题列表 - 第38722页

Visual Studio 2008生产力电动工具

我看到这些已经针对VS 2010发布.我正在尝试为VS 2008找到它们,但我无法找到它们.任何人都可以提供链接吗?非常感激!

visual-studio-2008 visual-studio productivity-power-tools

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

如果我超载它,如何调用原始的"operator new"?

假设我需要重载全局::operator new() 以便为每个分配的对象存储额外的数据.所以基本上它会这样工作:

  • 对于每次调用global ::operator new(),它将传递对象大小并添加额外数据的大小
  • 它将分配一个在前一步推导出的大小的内存块
  • 它会将指针偏移到未被额外数据占用的块部分,并将该偏移值返回给调用者

::operator delete() 反向移动指针,访问额外数据,释放内存.

现在的问题是如何分配内存?当然我可以调用malloc()或者某些特定于平台的功能(通常是这样做的).但通常当我需要在C++中分配原始内存时,我会调用::operator new().我可以调用原始文件::operator new()从我重载的全局内部进行内存分配::operator new()吗?

c++ memory memory-management operator-overloading

29
推荐指数
1
解决办法
4904
查看次数

有没有办法检查应用程序签名是否已调试或发布?

我目前正在开发RPC服务供开发人员使用,但我想确保我可以区分另一个应用程序的调试密钥和他们的公钥.有没有办法检查另一个应用程序的密钥,并告诉它是否是调试密钥而不是已发布的应用程序密钥?

这样做的目的是能够告诉他们的应用程序何时处于开发或发布状态,因为我需要能够判断他们是应该访问我的开发服务器还是我的生产服务器.

security android certificate license-key

9
推荐指数
1
解决办法
2400
查看次数

处理器用法

可能重复:
使用WMI和C#的CPU使用率

如何使用WMI检索C#(.NET)中的CPU使用率%?是的,没有任何愚蠢的PerformanceCounter.

.net c# performance wmi processor

-1
推荐指数
1
解决办法
838
查看次数

如何使用registerReceiver方法?

我想使用BroadcastReceiver具有引用的动态注册,Activity以便它可以修改其UI.我正在使用Context.registerReceiver()方法,但接收方的onReceive()方法永远不会被调用.

以下是显示问题的示例代码:

package com.example;

import android.app.Activity;
import android.app.IntentService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;

public class RegisterBroadcastReceiver extends Activity {

    public static class MyIntentService extends IntentService {

        public MyIntentService() {
            super(MyIntentService.class.getSimpleName());
        }

        @Override
        protected void onHandleIntent(Intent intent) {
            Intent i = new Intent(this, MyBroadcastReceiver.class);
            sendBroadcast(i);
        }
    }

    public class MyBroadcastReceiver extends BroadcastReceiver {

        @Override
        public void onReceive(Context context, Intent intent) {
            Log.i(MyBroadcastReceiver.class.getSimpleName(),
                  "received broadcast"); …
Run Code Online (Sandbox Code Playgroud)

android broadcastreceiver

45
推荐指数
2
解决办法
11万
查看次数

Python:pip在root目录中安装子包

我有这样的结构:

setup.py
package
    __init__.py
    sub_package
        ___init__.py
    sub_package2
        __init__.py
Run Code Online (Sandbox Code Playgroud)

如果我通过setup.py install安装软件包,那么它可以正常工作(通过将整个软件包复制到site-packages目录):

site_packages
    package
        sub_package
        sub_package2
Run Code Online (Sandbox Code Playgroud)

但是如果我运行pip install package,那么pip会将每个子包安装为独立的包:

site-packages
    package
    sub_package
    sub_package2
Run Code Online (Sandbox Code Playgroud)

我怎么能避免这个?我使用setuptools中的find_packages()来指定包.

python distutils pip setuptools

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

为什么CLLocation坐标在显示时会失去精度?

我正在进行一些实验,试图通过对随时间收集的数据进行加权平均来提高iPhone上的GPS准确度.我注意到控制台,iPhone模拟器和iPhone本身的坐标显示有所不同.

我正在运行基本的CoreLocation代码来设置我的位置管理器.

self.locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];

[locationManager startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)

在我的locationManager中:didUpdateToLocation:fromLocation:方法我使用NSLog以几种格式将坐标写入控制台,然后在我的IBOutlets中显示它们.

NSLog(@"%@", newLocation);
NSLog(@"%f", newLocation.coordinate.latitude);
NSLog(@"%e", newLocation.coordinate.latitude);
NSLog(@"%E", newLocation.coordinate.latitude);

self.latitude.text = [NSString stringWithFormat:@"%f", newLocation.coordinate.latitude];
self.longitude.text = [NSString stringWithFormat:@"%f", newLocation.coordinate.longitude];
self.altitude.text = [NSString stringWithFormat:@"%f", newLocation.altitude];
self.horizontalAccuracy.text = [NSString stringWithFormat:@"%f", newLocation.horizontalAccuracy];
self.verticalAccuracy.text = [NSString stringWithFormat:@"%f", newLocation.verticalAccuracy];
Run Code Online (Sandbox Code Playgroud)

写入控制台的值如下所示.

NSLog(@"%@", ...);  | <+42.40334972, -71.27483790> +/- 240.00m (speed -1.00 mps / course -1.00) @ 2010-10-19 12:15:00 GMT
NSLog(@"%f", ...); | 42.403350
NSLog(@"%e", ...); | 4.240335e+01
NSLog(@"%E", ...); | 4.240335E+01
Run Code Online (Sandbox Code Playgroud)

屏幕上显示的纬度和经度如下.

Latitude | …
Run Code Online (Sandbox Code Playgroud)

iphone precision gps ios-simulator

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

PHP致命错误:imap_headerinfo():地址缓冲区

当我cron跑步时,我正面临着问题.这是我的错误:

PHP Fatal error:  
imap_headerinfo(): Address buffer overflow.
Run Code Online (Sandbox Code Playgroud)

php

-1
推荐指数
1
解决办法
1450
查看次数

使用/不使用delegate()启动线程

有什么区别:

new Thread(new ThreadStart(SomeFunc))
Run Code Online (Sandbox Code Playgroud)

和:

new Thread( delegate() { SomeFunc();} )
Run Code Online (Sandbox Code Playgroud)

此代码在我的计算机上提供奇怪的输出:

public class A
{
    int Num;

    public A(int num)
    {
        Num = num;
    }

    public void DoObj(object obj)
    {
        Console.Write(Num);
    }

    public void Do()
    {
        Console.Write(Num);
    }
}

/////// in void main()

for (int i = 0; i < 10; i++)
{
    (new Thread(new ThreadStart((new A(i)).Do))).Start(); // Line 1
    (new Thread(new ThreadStart(delegate() { (new A(i)).Do(); }))).Start(); // Line 2
    (new Thread(delegate() { (new A(i)).Do(); })).Start(); // Line 3 …
Run Code Online (Sandbox Code Playgroud)

c# multithreading delegates

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

IIS 7 URL重写规则未应用

我有一个托管在IIS7服务器上的.net 4.0 Web应用程序.

阅读本文后:http://learn.iis.net/page.aspx/496/iis-url-rewriting-and-aspnet-routing/关于从另一台服务器提供静态内容,以便每次请求都不会发送cookie对于静态文件,我尝试了但没有太大的成功.

这是在web.config文件中编写的部分:

<system.webServer>
    <rewrite>
        <rules>
            <rule name="images" stopProcessing="true">
                <match url="^images/(.*)$" />
                <action type="Rewrite" url="http://static-server.com/images/{R:1}" appendQueryString="true" logRewrittenUrl="true" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

定义此规则后,应将映像文件夹中文件的每个链接重写到静态服务器URL中.但这根本不起作用,现在images文件夹中的每个图像都返回404未找到的图像.任何可能导致此行为的想法,或者如何从不同服务器的特定文件夹中提供文件的不同解决方案,而不必通过大量代码并更改链接到静态服务器的所有链接?

我也尝试使用重定向操作类型而不是实际工作的重写操作,但它无法解释为什么我试图在不同的服务器上提供文件的原因(这种方式请求被发送到我的动态内容服务器所有必需的cookie并重定向到静态服务器,这实际上比从动态内容服务器提供图像更糟糕.

asp.net iis-7 url-rewriting url-rewrite-module

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