问题列表 - 第8065页

从SUM列中删除" - "

分组,我需要从列中的任何负数中删除" - "以获取某些记录号.但是Sum需要*.01来获得正确的格式.我尝试使用替换,但它被*.01抛出.下面是我的语法.

CASE WHEN SUM(ExtPrice) *.01 < 0 AND RecordNum BETWEEN 4000 AND 5999 
        THEN REPLACE(SUM(ExtPrice) *.01,'-','')
     ELSE SUM(ExtPrice) *.01 
END AS Totals
Run Code Online (Sandbox Code Playgroud)

例如,SUM(ExtPrice) *.01 在一列中给出了-5051.32,但是当我使用上面的case语句时,我得到5050另一个例子-312.67,我得到310使用案例.任何建议或更好的方法,非常感谢.

sql

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

使用Excel Interop并获取打印对话框

我有以下代码:[谢谢Mike Rosenblum!]

使用系统; 使用System.Collections.Generic; 使用System.Linq; 使用System.Text; 使用Microsoft.Office.Interop.Excel; 使用System.Runtime.InteropServices;

namespace ConsoleApplication17 {class Program {

    static void Main(string[] args) {



    //public void PrintMyExcelFile() 
    //{
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();

// Open the Workbook:
Microsoft.Office.Interop.Excel.Workbook wb = excelApp.Workbooks.Open(
    @"C:\hello.xls",
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, 
    Type.Missing, Type.Missing,Type.Missing,Type.Missing);

// Get the first worksheet.
// (Excel uses base 1 indexing, not base 0.)
Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets[1];

// Print out 1 copy to the default printer:
ws.PrintOut(
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, …
Run Code Online (Sandbox Code Playgroud)

c# printing interop

3
推荐指数
1
解决办法
9423
查看次数

jQuery覆盖默认验证错误消息显示(Css)Popup/Tooltip之类的

我试图用div而不是标签来越过默认的错误消息标签.我也看过这篇文章,并了解如何做到这一点,但我对CSS的限制令我难以忘怀.我如何像其中一些示例一样显示:

示例#1(Dojo) - 必须键入无效输入才能看到错误显示
示例#2

下面是一些示例代码,它将错误标签覆盖为div元素

$(document).ready(function(){
            $("#myForm").validate({
                rules: {
                    "elem.1": {
                        required: true,
                        digits: true
                    },
                    "elem.2": {
                        required: true
                    }
                },
                errorElement: "div"
            });                  
        });
Run Code Online (Sandbox Code Playgroud)

现在我对css部分感到茫然,但现在它是:

div.error {
        position:absolute;
        margin-top:-21px;
     margin-left:150px;
     border:2px solid #C0C097;
        background-color:#fff;
        color:white;
        padding:3px;
        text-align:left;
        z-index:1;
        color:#333333;
     font:100% arial,helvetica,clean,sans-serif;
     font-size:15px;
     font-weight:bold;  
    }
Run Code Online (Sandbox Code Playgroud)

更新:

好吧我现在正在使用这个代码,但是弹出窗口上的图像和位置比边框大,可以调整为动态高度吗?

if (element.attr('type') == 'radio' || element.attr('type') == 'checkbox') {
   element = element.parent();

   offset = element.offset();
   error.insertBefore(element)
   error.addClass('message');  // add a class to the wrapper
   error.css('position', 'absolute');
   error.css('left', offset.left + …
Run Code Online (Sandbox Code Playgroud)

css jquery popup tooltip custom-errors

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

如何在未经我许可的情况下让Visual Studio在构建期间停止复制DLL?

我有一个依赖于几个DLL引用的Visual Studio项目.以下是我的csproj中这些引用的示例:

<ItemGroup>
  <Reference Include="Class1.Project1">
    <SpecificVersion>False</SpecificVersion>
    <HintPath>..\bin\Class1.Project1.dll</HintPath>
    <Private>False</Private>
  </Reference>
  <Reference Include="Class1.Project2">
    <SpecificVersion>False</SpecificVersion>
    <HintPath>..\bin\Class1.Project2.dll</HintPath>
    <Private>False</Private>
  </Reference>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)

但是,当我将此类作为项目依赖项包含在Web站点项目中时,Visual Studio将查找上面显示的依赖项的依赖项.在构建期间,Visual Studio将"复制本地"属性默认为"True",并将这些依赖项复制到我的网站的〜/ bin目录中.

反过来,这会覆盖此目录中已存在的DLL文件的版本.这会导致以下错误:

无法加载文件或程序集'Class5.Project5,Version = 3.6.1861.2,Culture = neutral,PublicKeyToken = dfeaee0e3978ac79'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

如何让我的Visual Studio默认情况下,"复制本地"设置为"假"的一切?我不希望Visual Studio在构建期间自动复制DLL文件.我也不希望我的领带构建以非常一个DLL的特定版本.

copy-local visual-studio

8
推荐指数
1
解决办法
8116
查看次数

这些链接错误意味着什么?(C++)(MSVC++)

编辑:当我将link_def.cpp与link_dec.h合并时,我只得到第一个错误,而不是第二个错误.

当我尝试编译一些代码时,我遇到了这些链接器错误:CODE:

#include"list_dec.h"
#include"catch.h"

int main()
{
    list<int, 100> L1;
    try
    {
        L1.return_current();
    }
    catch(err)
    {
        return -1;
    }
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

错误:

Linking...
main.obj : error LNK2019: unresolved external symbol "public: __thiscall list<int,100>::~list<int,100>(void)" (??1?$list@H$0GE@@@QAE@XZ) referenced in function __catch$_main$0
main.obj : error LNK2019: unresolved external symbol "public: int __thiscall list<int,100>::return_current(void)" (?return_current@?$list@H$0GE@@@QAEHXZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: __thiscall list<int,100>::list<int,100>(void)" (??0?$list@H$0GE@@@QAE@XZ) referenced in function _main
Run Code Online (Sandbox Code Playgroud)

如果有人需要list_dec.h,catch.h和list_def.cpp(列表类的定义)的代码,只需注释,我不想包含它们,如果它们是无关紧要的,因为它们非常大.

因为有人想看list_dec.h(我暂时与list_def.cpp合并)list_dec.h:

template<class T, size_t limit>
class list
{
public: …
Run Code Online (Sandbox Code Playgroud)

c++ linker templates

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

Java开源课程管理系统

我正在寻找一个开源项目来提供课程培训和管理课程,教师.我需要类似于Moodle的东西但是在Java中.谢谢

java open-source sakai

3
推荐指数
1
解决办法
5896
查看次数

调试器不适用于JMockit

希望对某人来说这是一个简单的问题.....

我正在使用RAD 7.5.2,正在编写Junit测试.我用JUnit 3编写它们就好了,然后我想模拟一些函数调用.所以我加载了jmockit 0.9.7和Junit 4.6.我还包括-javaagent:jmockit.jar作为VM参数.

当我"运行为Junit测试"时,它完全没有任何问题(至少,我没有看到输出).Junit的输出很好,没有错误被转储到控制台.

当我"调试为Junit测试"时,它将无法正常工作.它让我陷入:

InstrumentationImpl.class - >未找到源

......当我继续......

NativeMethodAccessorImpl.class - >找不到源

......当我继续打...

JUnit在此之后结束.它将以下内容转储到控制台:


异常线程 "main" java.lang.reflect.InvocationTargetException在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:43)在sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:160)的java.lang.reflect.Method.invoke(Method.java:618)中引起:java.lang.UnsatisfiedLinkError:sun/instrument/InstrumentationImpl.redefineClasses0([Ljava/lang/instrument/ClassDefinition;)V at the sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:98)at mockit.internal.RedefinitionEngine.redefineMethods(RedefinitionEngine.java:197)at mockit.internal.在mockit.internal.RedefinitionEngine.setUpInternalStartupMock(RedefinitionEngine.j)上的mockit.internal.RedefinitionEngine.redefineMethods(RedefinitionEngine.java:116)重新定义引擎.重定义方法(RedefinitionEngine.java:184)ava:53)at mockit.internal.Startup.loadInternalStartupMocks(Startup.java:123)at mockit.internal.Startup.initialize(Startup.java:110)at mockit.internal.Startup.premain(Startup.java:97). ..还有5个

致命错误:-javaagent的处理失败


我可以在我的测试中同时运行JUnit 3和JUnit 4,没问题,当我使用-javaagent:jmockit.jar(使用调试器;他们自己很好)时,事情变得丑陋,我必须这样做使用jmockit的东西.

思考?

debugging jmockit junit4 javaagents

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

类隐式转换

我知道我可以使用类的隐式转换,如下所示,但有没有办法让一个实例返回没有强制转换或转换的字符串?

public class Fred
{
    public static implicit operator string(Fred fred)
    {
        return DateTime.Now.ToLongTimeString();
    }
}

public class Program
{
    static void Main(string[] args)
    {
        string a = new Fred();
        Console.WriteLine(a);

        // b is of type Fred. 
        var b = new Fred(); 

        // still works and now uses the conversion
        Console.WriteLine(b);    

        // c is of type string.
        // this is what I want but not what happens
        var c = new Fred(); 

        // don't want to have to cast it …
Run Code Online (Sandbox Code Playgroud)

c# casting type-inference implicit-typing

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

Delphi自定义消息处理程序

当用户双击dbgrid时,我会显示一个非模态表单.

当他们关闭那个表格时,我想刷新网格.

为此,我尝试了以下方法:

1 - 定义自定义消息常量:

const
  WM_REFRESH_MSG = WM_USER + 1;  //defined in a globally available unit
Run Code Online (Sandbox Code Playgroud)

2 - 在我的非模态形式的OnClose事件中,我有:

procedure TMyNonModalForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  PostMessage(Self.Handle,WM_REFRESH_MSG,0,0);
end;
Run Code Online (Sandbox Code Playgroud)

3 - 在包含dbGrid的表单的私有声明中,我有:

procedure OnRefreshRequest(var Msg: TMessage); message WM_REFRESH_MSG;

...

procedure TMyFormWithADBGrid.OnRefreshRequest(var Msg: TMessage);
begin
  RefreshGrid;
end;
Run Code Online (Sandbox Code Playgroud)

执行这些操作后,PostMessage会触发,但OnRefreshRequest过程永远不会运行.我究竟做错了什么?

delphi windows-messages

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

在python中的whoami

找出运行python进程的用户的最佳方法是什么?

我能做到这一点:

name = os.popen('whoami').read() 
Run Code Online (Sandbox Code Playgroud)

但这必须开始一个全新的过程.

os.environ["USER"]
Run Code Online (Sandbox Code Playgroud)

有时工作,但有时不设置环境变量.

python posix

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