走过海棠暮

文章 评论 浏览 25

走过海棠暮 2024-08-31 04:08:03

Mac 顶部菜单与 Windows 方法之间的真正区别不仅仅在于菜单:- 它是如何使用菜单来破解打开的 MDI 应用程序的。

在 Windows 中,MDI 应用程序(例如 dev studio 和 Office)将所有文档窗口托管在应用程序框架窗口内。在 Mac 上,没有每个应用程序的框架窗口,所有文档窗口与其他应用程序的所有其他文档窗口共享桌面。

由于缺乏对传统 MDI 应用程序进行深入改造以将其文档窗口移至桌面的能力,获得桌面菜单的尝试无论多么高尚,似乎注定是一种新颖的东西,没有真正的用途或实用性。

考虑到所有因素,我对 Mac 和 Windows(以及 Linux)上窗口管理器的当前状态感到相当沮丧:浏览器中的选项卡式分页之类的东西实际上是应用程序开发人员的绝望行为,他们没有得到这些东西作为标准窗口管理器 - 我相信这是选项卡真正所属的地方。为什么 notepad++ 应该有一组选项卡、chrome、firefox 和 internet explorer(是的,我知道可以运行所有 4 个),以及开发工作室对接视图、各种绘画程序。

它只是对现代多文档界面应该是什么样子的不同解释的混乱。

The real difference between the Mac menu accross the top, and the Windows approach, is not just in the menu :- Its how the menu is used to crack open MDI apps.

In windows, MDI applications - like dev studio and office - have all their document windows hosted inside an application frame window. On the Mac, there are no per-application frame windows, all document windows share the desktop with all other document windows from other applications.

Lacking the ability to do a deep rework of traditional MDI apps to get their document windows out and onto the desktop, an attempt, however noble, to get a desktop menu, seems doomed to be a novelty with no real use or utility.

I am, all things considered, rather depressed by the current state of window managers on both Mac and Windows (and Linux): Things like tabbed paged in browsers are really acts of desperation by application developers who have not been given such things as part of the standard window manager - which is where I believe tabs really belong. Why should notepad++ have a set of tabs, and chrome, and firefox, and internet explorer (yes, I have been known to run all 4), along with dev studios docking view, various paint programs.

Its just a mess of different interpretations of what a modern multi document interface should look like.

Windows 系统范围内的 Mac 风格菜单

走过海棠暮 2024-08-30 21:54:18

尝试Driver.Data.Module.DriverDataModule、Driver.Data.Module。

您还可以通过实例化该类型的对象并检查其 Type 的 AssemblyQualifiedName 属性来找到该类型的完整程序集限定名称:

DriverDataModule module = new DriverDataModule();
string fullyQualifiedName = module.GetType().AssemblyQualifiedName;

Try Driver.Data.Module.DriverDataModule, Driver.Data.Module.

You can also find the full assembly-qualified name of your type by instantiating an object of that type and examining the AssemblyQualifiedName property of its Type:

DriverDataModule module = new DriverDataModule();
string fullyQualifiedName = module.GetType().AssemblyQualifiedName;

需要完全限定的类型名称

走过海棠暮 2024-08-30 20:54:17

您需要添加对 WinForms 程序集的引用

  • 右键单击​​解决方案并选择“添加引用”
  • 选择 System.Windows.Forms 并单击“确定”

您可能还需要对 System.Data 执行相同的操作,具体取决于您的项目设置

You need to add a reference to the WinForms assembly

  • Right click on the solution and select "Add Reference"
  • Select System.Windows.Forms and hit OK

You may need to do the same for System.Data as well depending on your project setup

有没有办法将我的控制台应用程序转换为 C# 中的 Windows 窗体应用程序?

走过海棠暮 2024-08-30 12:13:17

当您尝试将项目作为网站打开时,会出现此错误。确定您是否已创建网站或项目的最简单方法是检查您的解决方案文件夹(即保存代码的位置)并查看根目录中是否有 *.sln 文件,如果有,那么您'创建了一个项目。

只是补充一下,当我尝试打开不久前通过从 Visual Studio 菜单中选择“文件”、“打开网站”创建的项目时,我遇到了此错误,而我应该选择“文件”、“打开项目”反而。我一意识到就捂脸:)

This error occurs when you attempt to open a project as a website. The easiest way to determine if you've created a website or a project is to check your solution folder (i.e. where you saved your code) and see if you have a *.sln file in the root directory, if you do then you've created a project.

Just to add, I encountered this error just now when I attempted to open a project I created a while back by selecting "File", "Open Website" from the Visual Studio menus whereas I should have selected "File", "Open Project" instead. I facepalmed as soon as I realised :)

错误:allowDefinition=“MachineToApplication”超越应用层

走过海棠暮 2024-08-30 03:58:19

将 UIControl 设置为禁用并不会阻止它获取触摸事件(并且无论如何您都不应该在 UIControl 上覆盖 -touchesBegan: 等)。

您应该将按钮的 userInteractionEnabled 属性设置为 NO 以避免触摸事件。

Setting a UIControl disabled does not prevent it from getting touch events (and you shouldn't override -touchesBegan: etc on a UIControl anyway).

You should set the button's userInteractionEnabled property to NO to avoid the touch events.

禁用的按钮如何获得触摸?

走过海棠暮 2024-08-30 01:47:13

gcc 不报告任何错误/警告。但 g++ 确实如此。

编辑:

看起来C允许暂定定义< /strong> 为变量。

在您的情况下,两个全局定义都是暂定的,在这种情况下,将选择链接器看到的第一个定义。

将 file2 更改为:

char global = 1; // no more tentative...but explicit.

现在,如果像以前一样编译,则 file1 中的暂定 def 将被忽略。

通过以下方式使两个 def 显式化:

int global = 1; // in file1

char global = 1; // in file2

现在两者都不能被忽略,我们会得到多个 def 错误。

gcc does not report any error/warnings. But g++ does.

EDIT:

Looks like C allows tentative definitions for a variable.

In your case both the global definitions are tentative and in that case the first one seen by the linker is chosen.

Change your file2 to:

char global = 1; // no more tentative...but explicit.

Now if you compile like before, the tentative def in file1 will be ignored.

Make both the def explicit by:

int global = 1; // in file1

char global = 1; // in file2

now neither can be ignored and we get the multiple def error.

全局变量实现

走过海棠暮 2024-08-30 00:35:22

我们最终得到了微软的修补程序和一些自定义类

We ended up with a hotfix from microsoft and few custom classes

如何将 BinarySecurityToken 获取到 wcf Soap 请求中

走过海棠暮 2024-08-30 00:27:56

是否需要发布?不都是
已处理的属性
自动?

这取决于属性如何实现。如果它是自动实现的(@synthesize'd),则该属性将在 setter 中保留其值,并在设置为其他值时释放它。如果您刚刚接触 Obj-C 和 Cocoa,您应该阅读有关内存管理的约定。我在我的博客上发布了帖子关于它们,其他地方也有大量资源。

如何检查引用计数以查看
发生了什么,用于调试
目的...?

您可以检查 NSObject keepCount 属性。有关信息

Is the release necessary? Aren't all
properties already handled
automatically?

It depends on how the property is implemented. If it is auto-implemented (@synthesize'd), the property will retain its value in the setter and release it if set to another value. If you just got into Obj-C and Cocoa, you should read about the conventions for memory management. I have put up a post on my blog about them, there are plenty of resources elsewhere too.

How can I check the ref count to see
what's happening, for debug
purposes...?

You can check the NSObject retainCount property. Information on that is here. For advanced debugging purposes, there is the NSZombieEnabled environment flag that will cause all release message to not decrement the reference count but log an error when an object that would have normally been released is accessed.

我需要在 dealloc 中释放吗?

走过海棠暮 2024-08-29 23:35:48
>>>> l = [(1,2), (3,4)]
>>>> for i, e in enumerate(l):
....     l[i] = (e[0]+xk, e[1]+yk)

一如既往,未经测试。 ;-)

如果不需要就地做就更简单了

>>>> l = [(e[0]+xk, e[1]+yk) for e in l]
>>>> l = [(1,2), (3,4)]
>>>> for i, e in enumerate(l):
....     l[i] = (e[0]+xk, e[1]+yk)

As always, untested. ;-)

If you don't need to do it in place, it's even simpler

>>>> l = [(e[0]+xk, e[1]+yk) for e in l]

将常量元组值添加到元组列表中

走过海棠暮 2024-08-29 19:34:11
  1. 静态构造函数中不允许使用 public 等访问修饰符,因此请从 class1 构造函数中删除 public。

  2. 错误检查需要 2 个您未传入的参数。

我做了这两件事,它符合要求。

  1. Access modifiers like public are not allowed on static constructors so drop the public from the class1 constructor.

  2. error check takes 2 paramters which your not passing in.

I did those two things and it complied.

C# 未找到标识符

走过海棠暮 2024-08-29 15:28:55

最好,根据您指定的条件:

import cPickle
   ...
thestring = cPickle.dumps(thedict, -1)

-1 确保最有效的序列化并生成二进制 字符串(任意字节字符串)。如果您需要一个 ascii 字符串(因为例如将会发生一些 Unicode 转码,并且您无法将字段的类型从 TEXT 切换为 BLOB< /code>),避免使用 -1,但效率会降低。

无论哪种情况,要稍后从字符串中获取字典,

thenewdict = cPickle.loads(thestring)

Best, under your stated conditions:

import cPickle
   ...
thestring = cPickle.dumps(thedict, -1)

the -1 ensures the most efficient serialization and produces a binary string (arbitrary string of bytes). If you need an ascii string (because e.g. some Unicode transcoding is going to happen and you can't switch the field's type from, say, TEXT to BLOB), avoid the -1, but you'll then be less efficient.

To get the dict back later from the string, in either case,

thenewdict = cPickle.loads(thestring)

如何在数据库中存储字典/列表?

走过海棠暮 2024-08-29 10:57:57

您不应该向您自己的服务器发送请求。您应该包含该文件并直接执行函数。

You shouldn't be sending requests to your own server. You should include the file and execute the functions directly.

如何使 php 脚本只回答来自同一服务器的请求?

走过海棠暮 2024-08-29 06:16:30

如果您使用基于 RPM 的发行版,

# rpm -Uvh --repackage pkg-1-1.i386.rpm

它将重新打包旧文件并在事务中升级,以便您可以在出现问题时进行回滚。例如,要回滚到昨天的状态,

# rpm -Uvh --rollback yesterday

请参阅 本文了解其他示例。

If you are using an RPM based distro

# rpm -Uvh --repackage pkg-1-1.i386.rpm

will repackage the old files and upgrade in a transaction so you can later rollback if something went wrong. To rollback to yesterday's state for example

# rpm -Uvh --rollback yesterday

See this article for other examples.

查找与软件相关的文件

走过海棠暮 2024-08-29 06:04:42

这是一个顺序行*列的解决方案,

它的工作原理是从

  • 数组的底部开始,并确定每个数字下面有多少项与其在列中匹配。这是在 O(MN) 时间内完成的(非常简单)
  • 然后它从上到下&从左到右,看看是否有任何给定的数字与左边的数字匹配。如果是这样,它会跟踪高度之间的关系,以跟踪可能的矩形形状。

这是一个有效的 python 实现。抱歉,因为我不确定如何使语法突出显示工作

# this program finds the largest area in an array where all the elements have the same value
# It solves in O(rows * columns) time  using  O(rows*columns) space using dynamic programming




def max_area_subarray(array):

    rows = len(array)
    if (rows == 0):
        return [[]]
    columns = len(array[0])


    # initialize a blank new array
    # this will hold max elements of the same value in a column
    new_array = []
    for i in range(0,rows-1):
        new_array.append([0] * columns)

    # start with the bottom row, these all of 1 element of the same type 
    # below them, including themselves
    new_array.append([1] * columns)

    # go from the second to bottom row up, finding how many contiguous
    # elements of the same type there are
    for i in range(rows-2,-1,-1):
        for j in range(columns-1,-1,-1):
            if ( array[i][j] == array[i+1][j]):
                new_array[i][j] = new_array[i+1][j]+1
            else:
                new_array[i][j] = 1


    # go left to right and match up the max areas
    max_area = 0
    top = 0
    bottom = 0
    left = 0
    right = 0
    for i in range(0,rows):
        running_height =[[0,0,0]]
        for j in range(0,columns):

            matched = False
            if (j > 0):  # if this isn't the leftmost column
                if (array[i][j] == array[i][j-1]):
                    # this matches the array to the left
                    # keep track of if this is a longer column, shorter column, or same as 
                    # the one on the left
                    matched = True

                    while( new_array[i][j] < running_height[-1][0]):
                        # this is less than the one on the left, pop that running 
                        # height from the list, and add it's columns to the smaller
                        # running height below it
                        if (running_height[-1][1] > max_area):
                            max_area = running_height[-1][1]
                            top = i
                            right = j-1
                            bottom = i + running_height[-1][0]-1
                            left = j - running_height[-1][2]

                        previous_column = running_height.pop()
                        num_columns = previous_column[2]

                        if (len(running_height) > 0):
                            running_height[-1][1] += running_height[-1][0] * (num_columns)
                            running_height[-1][2] += num_columns

                        else:
                            # for instance, if we have heights 2,2,1
                            # this will trigger on the 1 after we pop the 2 out, and save the current
                            # height of 1,  the running area of 3, and running columsn of 3
                            running_height.append([new_array[i][j],new_array[i][j]*(num_columns),num_columns])


                    if (new_array[i][j] > running_height[-1][0]):
                        # longer then the one on the left
                        # append this height and area
                        running_height.append([new_array[i][j],new_array[i][j],1])
                    elif (new_array[i][j] == running_height[-1][0]):   
                        # same as the one on the left, add this area to the one on the left
                        running_height[-1][1] += new_array[i][j]
                        running_height[-1][2] += 1



            if (matched == False or j == columns -1):
                while(running_height):
                    # unwind the maximums & see if this is the new max area
                    if (running_height[-1][1] > max_area):
                        max_area = running_height[-1][1]
                        top = i
                        right = j
                        bottom = i + running_height[-1][0]-1
                        left = j - running_height[-1][2]+1

                        # this wasn't a match, so move everything one bay to the left
                        if (matched== False):
                            right = right-1
                            left = left-1


                    previous_column = running_height.pop()
                    num_columns = previous_column[2]
                    if (len(running_height) > 0):
                        running_height[-1][1] += running_height[-1][0] * num_columns
                        running_height[-1][2] += num_columns

            if (matched == False):
                # this is either the left column, or we don't match to the column to the left, so reset
                running_height = [[new_array[i][j],new_array[i][j],1]]
                if (running_height[-1][1] > max_area):
                    max_area = running_height[-1][1]
                    top = i
                    right = j
                    bottom = i + running_height[-1][0]-1
                    left = j - running_height[-1][2]+1


    max_array = []
    for i in range(top,bottom+1):
        max_array.append(array[i][left:right+1])


    return max_array



numbers = [[6,4,1,9],[5,2,2,7],[2,2,2,1],[2,3,1,5]]

for row in numbers:
    print row

print
print

max_array =  max_area_subarray(numbers)    


max_area = len(max_array) * len(max_array[0])
print 'max area is ',max_area
print 
for row in max_array:
    print row

This is an order Rows*Columns Solution

It works by

  • starting at the bottom of the array, and determining how many items below each number match it in a column. This is done in O(MN) time (very trivially)
  • Then it goes top to bottom & left to right and sees if any given number matches the number to the left. If so, it keeps track of how the heights relate to each other to track the possible rectangle shapes

Here is a working python implementation. Apologies since I'm not sure how to get the syntax highlighting working

# this program finds the largest area in an array where all the elements have the same value
# It solves in O(rows * columns) time  using  O(rows*columns) space using dynamic programming




def max_area_subarray(array):

    rows = len(array)
    if (rows == 0):
        return [[]]
    columns = len(array[0])


    # initialize a blank new array
    # this will hold max elements of the same value in a column
    new_array = []
    for i in range(0,rows-1):
        new_array.append([0] * columns)

    # start with the bottom row, these all of 1 element of the same type 
    # below them, including themselves
    new_array.append([1] * columns)

    # go from the second to bottom row up, finding how many contiguous
    # elements of the same type there are
    for i in range(rows-2,-1,-1):
        for j in range(columns-1,-1,-1):
            if ( array[i][j] == array[i+1][j]):
                new_array[i][j] = new_array[i+1][j]+1
            else:
                new_array[i][j] = 1


    # go left to right and match up the max areas
    max_area = 0
    top = 0
    bottom = 0
    left = 0
    right = 0
    for i in range(0,rows):
        running_height =[[0,0,0]]
        for j in range(0,columns):

            matched = False
            if (j > 0):  # if this isn't the leftmost column
                if (array[i][j] == array[i][j-1]):
                    # this matches the array to the left
                    # keep track of if this is a longer column, shorter column, or same as 
                    # the one on the left
                    matched = True

                    while( new_array[i][j] < running_height[-1][0]):
                        # this is less than the one on the left, pop that running 
                        # height from the list, and add it's columns to the smaller
                        # running height below it
                        if (running_height[-1][1] > max_area):
                            max_area = running_height[-1][1]
                            top = i
                            right = j-1
                            bottom = i + running_height[-1][0]-1
                            left = j - running_height[-1][2]

                        previous_column = running_height.pop()
                        num_columns = previous_column[2]

                        if (len(running_height) > 0):
                            running_height[-1][1] += running_height[-1][0] * (num_columns)
                            running_height[-1][2] += num_columns

                        else:
                            # for instance, if we have heights 2,2,1
                            # this will trigger on the 1 after we pop the 2 out, and save the current
                            # height of 1,  the running area of 3, and running columsn of 3
                            running_height.append([new_array[i][j],new_array[i][j]*(num_columns),num_columns])


                    if (new_array[i][j] > running_height[-1][0]):
                        # longer then the one on the left
                        # append this height and area
                        running_height.append([new_array[i][j],new_array[i][j],1])
                    elif (new_array[i][j] == running_height[-1][0]):   
                        # same as the one on the left, add this area to the one on the left
                        running_height[-1][1] += new_array[i][j]
                        running_height[-1][2] += 1



            if (matched == False or j == columns -1):
                while(running_height):
                    # unwind the maximums & see if this is the new max area
                    if (running_height[-1][1] > max_area):
                        max_area = running_height[-1][1]
                        top = i
                        right = j
                        bottom = i + running_height[-1][0]-1
                        left = j - running_height[-1][2]+1

                        # this wasn't a match, so move everything one bay to the left
                        if (matched== False):
                            right = right-1
                            left = left-1


                    previous_column = running_height.pop()
                    num_columns = previous_column[2]
                    if (len(running_height) > 0):
                        running_height[-1][1] += running_height[-1][0] * num_columns
                        running_height[-1][2] += num_columns

            if (matched == False):
                # this is either the left column, or we don't match to the column to the left, so reset
                running_height = [[new_array[i][j],new_array[i][j],1]]
                if (running_height[-1][1] > max_area):
                    max_area = running_height[-1][1]
                    top = i
                    right = j
                    bottom = i + running_height[-1][0]-1
                    left = j - running_height[-1][2]+1


    max_array = []
    for i in range(top,bottom+1):
        max_array.append(array[i][left:right+1])


    return max_array



numbers = [[6,4,1,9],[5,2,2,7],[2,2,2,1],[2,3,1,5]]

for row in numbers:
    print row

print
print

max_array =  max_area_subarray(numbers)    


max_area = len(max_array) * len(max_array[0])
print 'max area is ',max_area
print 
for row in max_array:
    print row

求最大子矩阵算法

走过海棠暮 2024-08-29 04:49:02

我会这样写:

using System.ComponentModel;
using System;

// ...

[ EditorBrowsableAttribute(EditorBrowsableState.Advanced) ] 
internal static ResourceManager : Resources.ResourceManager 
{ 
    get
    { 
        when (object.ReferenceEquals(resourceMan, null))
        {
            resourceMan = Resources.ResourceManager
                ( "splashscreen.Properties.Resources"
                , typeof(Resources).Assembly
                ); 
        }
        resourceMan; 
    } 
}

I would write it like this:

using System.ComponentModel;
using System;

// ...

[ EditorBrowsableAttribute(EditorBrowsableState.Advanced) ] 
internal static ResourceManager : Resources.ResourceManager 
{ 
    get
    { 
        when (object.ReferenceEquals(resourceMan, null))
        {
            resourceMan = Resources.ResourceManager
                ( "splashscreen.Properties.Resources"
                , typeof(Resources).Assembly
                ); 
        }
        resourceMan; 
    } 
}

缓存ResourceManager实例请求—如何将代码转换为 Nemerle

更多

推荐作者

寻梦旅人

文章 0 评论 0

冰美式不加糖

文章 0 评论 0

m0_51416705

文章 0 评论 0

123456wqwqwq

文章 0 评论 0

qq_R47skh

文章 0 评论 0

hs1283

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文