走过海棠暮

文章 0 评论 0 浏览 24

走过海棠暮 2024-10-15 09:21:19

经过很多努力我已经解决了这个问题。绑定 DataGridView 当数据源中有一些数据时,它可能是列表或数据表。

After lots of effort i have solved this issue. Bind your DataGridView When you have some data in the Data Source either it would be a list or DataTable.

Windows窗体应用程序异常

走过海棠暮 2024-10-15 07:48:08

作为黑客,我创建了一个 1 像素高、8.5 英寸宽的白色图像并将其嵌入到我的报告中。这迫使报表宽度为 8.5 英寸,但没有解释如何让渲染引擎使报表自动展开。

As a hack, I've created a 1 px tall, 8.5 inch wide white image and embedded it in my report. This forces the report to 8.5 inches wide, but doesn't explain how to get the rendering engine to make the report expand automatically.

SSRS 2005 - 订阅电子邮件被压缩到左侧

走过海棠暮 2024-10-15 06:08:47

使用 Perl 而不是 Python。该程序(SinFP)是用 Perl 编写的,您可以修改代码以满足您的需要。

Use Perl instead of Python. The program (SinFP) is written in Perl, you can modify the code to suite your needs.

使用外部工具、subprocess.Popen 和线程进行多端口扫描

走过海棠暮 2024-10-15 03:05:32

你可以先从指定的url下载php脚本文档,然后给出http-client链接来下载本地存储的文件。或将文档内容放入输出流:

 $cont = file_get_contents($_GET['url']);
  header('Content-Type: application/octet-stream');
  header("Content-Transfer-Encoding: binary ");
  header('Accept-Ranges: bytes');
  header('Content-disposition: attachment; filename=' . $new_file_name));
  echo($cont);

you can first download from php script document from specified url, then give http-client link to download locally stored file. or put document content to output stream:

 $cont = file_get_contents($_GET['url']);
  header('Content-Type: application/octet-stream');
  header("Content-Transfer-Encoding: binary ");
  header('Accept-Ranges: bytes');
  header('Content-disposition: attachment; filename=' . $new_file_name));
  echo($cont);

是否可以将图像从网络复制到硬盘?

走过海棠暮 2024-10-14 23:51:17

有多种方法可以阻止方法对作为参数传递的对象进行更改:

  • 制作对象的副本,然后传递该副本。复制对象的方法有很多种。复制构造函数和静态工厂方法可能比实现 clone() 更好。
  • 为对象的类创建一个只读包装类,实例化它并传递它。只读包装器要么不提供更新方法,要么实现它们不执行任何操作,或者引发异常。
  • 重构对象的 API,使其具有只读接口和读写接口,并将其作为前者的实例传递。 (当然,调用者可以尝试将其强制转换为后者...)
  • 使用 Java 安全性来防止不需要的更新。 (这是昂贵且复杂的......)

当然,如果您试图“保护”的对象具有您想要防止更改的深层结构,那么您需要确保处理这个问题;例如,通过深度复制、通过返回组件对象的副本或返回它们的包装等等。

上述大多数方法都会增加复杂性和运行时成本,因此我的建议是避免您需要执行此类操作的设计。如果可行,只需记录该对象应被视为只读,并将其留给编写该方法的人员的常识来执行正确的操作。

例如,众所周知的事实是,您不应更改用作 Map 中的键的对象的状态,以免其值发生变化。然而,通常不采取任何措施来尝试“强制”这一点;即使用可变对象作为键......并且只是不更改它们。

There are a number of approaches to stopping a method making changes to an object passed as a parameter:

  • Make a copy of the object, and pass the copy. There are a variety of ways of copying objects. Copy constructors and static factory methods are probably better than implementing clone().
  • Create a read-only wrapper class for the object's class, instantiate it and pass it. The read-only wrapper either doesn't provide the update methods, or implements them to do nothing, or throw exceptions.
  • Refactor the object's API so that it has an read-only interface and a read-write interface, and pass it as an instance of the former. (Of course, the caller can try to cast it to the latter ...)
  • Use Java security to prevent unwanted updates. (This is expensive and complicated ...)

Of course, if the object that you are trying to "protect" has deep structure that you want to prevent changes to, then you need to make sure that you deal with this; e.g. by deep copying, by returning copies of component objects or returning them wrapped, and so on.

Most of the approaches above add complexity and runtime cost, so my advice is to avoid designs where you need to do this kind of thing. If feasible, simply document that the object should be treated as read-only, and leave it to the common sense of the person who codes the method to do the right thing.

For example, it is a well known fact that you should not change the state of an object used as a key in a Map in such a way that its value changes. However, it is common to do nothing to try to "enforce" this; i.e. to use mutable objects as keys ... and just not change them.

java:传递引用数组?

走过海棠暮 2024-10-14 16:57:29

正如已经提到的,使用 == 是不正确的。为了便于阅读,请尝试:

field.getText().isEmpty()

field.getText().trim().isEmpty()

As has been mentioned, using == is not correct. For readability, try:

field.getText().isEmpty()

or

field.getText().trim().isEmpty()

关于Java中JTextField的一个问题

走过海棠暮 2024-10-14 15:40:45

如果有人仍在寻找答案,计算距离很简单(精确获取方向很难计算,如果有人知道简单的答案,请添加)

所以检查您的经纬度值之间的差异,将十进制度更改为 0.001 意味着 111m 距离。检查纬度和经度到十进制的变化最大 0.001 将在您的点周围绘制一个半径为 111m 的圆。

前任。您的起点是 A(Lat1,Lng1)。您想要测试的点 B(LatB,LngB) 、 C(LatC,LngC) .....

if: (Lat1 - 0.001) <纬度B (Lat1 + 0.001) && (Lng1-0.001)< LngB < (Lng1 + 0.001) == True // B 点半径为 100m。

如果:(Lat1 - 0.001) <纬度C < (Lat1 + 0.001) && (Lng1-0.001)<液化天然气碳< (Lng1 + 0.001) == False // C 点不在 100m 半径内。

十进制度参考 https://en.wikipedia.org/wiki/Decimal_ Degrees

十进制距离
01.0111公里
10.111.1公里
20.011.11公里
30.001111 m
40.000111.1 m
50.000011.11 m
60.0000010.111 m
70.00000011.11 cm
80.000000011.11毫米

if someone still looking for answer, calculating distance is simple ( getting direction precisely is hard to calculate, if someone knows simple answer for that please do add)

So check difference between your lat-long values, change in decimal degrees to 0.001 means 111m distance. checking both latitude and longitude to decimal degrees change max 0.001 will draw a 111m radius circle around your point.

Ex. your starting point is A(Lat1,Lng1). points you want to test B(LatB,LngB) , C(LatC,LngC) .....

if: (Lat1 - 0.001) < LatB < (Lat1 + 0.001) && (Lng1 - 0.001) < LngB < (Lng1 + 0.001) == True // point B is in 100m radious.

if: (Lat1 - 0.001) < LatC < (Lat1 + 0.001) && (Lng1 - 0.001) < LngC < (Lng1 + 0.001) == False // point C is Not in 100m radious.

Decimal degrees reference https://en.wikipedia.org/wiki/Decimal_degrees

decimaldegreesdistance
01.0111 km
10.111.1 km
20.011.11 km
30.001111 m
40.000111.1 m
50.000011.11 m
60.0000010.111 m
70.00000011.11 cm
80.000000011.11 mm

当经纬度已知点时计算100米距离

走过海棠暮 2024-10-14 14:37:50

每当有多个线程访问相同的资源时,您就必须担心线程安全,并且这些资源不是一成不变的。

You have to worry about thread safety whenever you have more than one thread accessing the same resources, and those resources are not immutable.

什么时候需要担心线程安全?

走过海棠暮 2024-10-14 09:31:38

好问题。我没有确切的解决方案,但这是我之前见过的方法:

执行 SELECT,将给定 userID 的 EventTimeStampMIN(EventTimeStamp) 进行比较,由同一表上的嵌套 SELECT 语句确定,以计算每个 ID 的 MIN 时间戳(例如 GROUP BY UserID)。

Good question. I don't have an exact solution but here's the approach I've seen before:

Do a SELECT where you compare the EventTimeStamp with MIN(EventTimeStamp) for a given userID, as determined by a nested SELECT statement on the same table to calculate the MIN timestamp for each ID (e.g. GROUP BY UserID).

MySQL 查询 - 查找“新”每日用户数

走过海棠暮 2024-10-14 01:17:48

XPath 1.0 中无法指定所选节点的顺序

XPath 2.0 允许节点的序列具有任何特定顺序

//object[@uid=2], //object[@uid=1]

计算结果为一个序列,其中所有带有 @uid=2object 项目位于所有带有 object 项目之前code>@uid=1

如果没有可用的 XPath 2.0 引擎,仍然可以使用 XSLT 以任何所需的顺序输出节点。

在此特定情况下以下 XSLT 指令的序列:

<xsl:copy-of select="//object[@uid=2]"/>

<xsl:copy-of select="//object[@uid=1]"/>

产生所需的输出

<object uid="2" /><object uid="1" />

There is no way in XPath 1.0 to specify the order of the selected nodes.

XPath 2.0 allows a sequence of nodes with any specific order:

//object[@uid=2], //object[@uid=1]

evaluates to a sequence in which all object items with @uid=2 precede all object items with @uid=1

If one doesn't have anXPath 2.0 engine available, it is still possible to use XSLT in order to output nodes in any desired order.

In this specific case the sequence of the following XSLT instructions:

<xsl:copy-of select="//object[@uid=2]"/>

<xsl:copy-of select="//object[@uid=1]"/>

produces the desired output:

<object uid="2" /><object uid="1" />

按照与多个选择参数相同的顺序对 XPath 结果进行排序

走过海棠暮 2024-10-13 20:12:59

确保页面指令中的 CodeFile/CodeBehind 属性指向正确的文件。如果是这样,请确保页面指令中的 Inherits 属性命名了正确的类名。

Make sure your CodeFile/CodeBehind attribute in the page directive is pointing to the correct file. If so, make sure the Inherits attribute in the page directive is naming the correct class name.

从代码隐藏访问下拉列表

走过海棠暮 2024-10-13 10:19:32

首先,这确实是苹果公司或你的律师或会计师的问题,而不是这样。但话虽如此:

您的真实姓名出现在个人帐户的 iTunes 商店中的基本原因是,当您在应用商店上销售时,您是一个法人实体(独资经营者),并且除非您有某种公司结构,否则应用程序的销售是客户和您之间的交换。这会产生与公司不同的税务和法律影响。苹果的目标不是说出你的“个人姓名”,而是明确实体关系。

成立一家公司(在美国,有限责任公司既简单又便宜,而且效果很好)是创建新实体进行销售的最快方式。您也许可以提交某种更简单的“做生意”文件,以其他名称经营独资企业,但这取决于当地法律,并且不会提供有限责任公司可以提供的(很少但真正的)法律保护在诉讼等情况下向您提供建议。

(即使作为个人,您也可以提供“公司”名称,这是在版权和卖方字段之外的地方显示的名称。但我假设您已经知道这一点。)

我的建议是:如果您只是测试水,或者做业余爱好项目,以自己的名义销售都可以——它不会影响人们的购买决定。如果您打算将其作为一项真正的业务来开展,那么申请有限责任公司无论如何都是一个简单而明智的步骤。

First off, this is really a question for Apple or your lawyers or accountants, not SO. But that said:

The basic reason your real name shows up in the iTunes store for an individual account is that when you're selling on the app store, you are a legal entity (sole proprietor), and unless you have some sort of company structure, the sale of the app is an exchange between the customer and you. This has tax and legal implications which are different than if you were a company. Apple's goal is not to out your "personal name", but to be clear about the entity relationship.

Forming an company (in the US, an LLC is easy, inexpensive, and works well for this) is the quickest way of creating a new entity to sell against. You may be able to file some sort of simpler "doing-business-as" papers to operate a sole proprietorship by another name, but that's dependent on local laws, and would offer none of the (scant but real) legal protection an LLC could offer you in the case of, say, a lawsuit.

(Even as an individual, you can provide a "company" name, which is what shows up in places besides the copyright and seller field. But I assume you already know this.)

My recommendation is this: if you're just testing the waters, or doing hobby projects, selling under your own name is fine-- it doesn't influence people's purchasing decisions. If you're making a go of it as a real business, filing for an LLC is a simple and smart step anyways.

我可以使用“屏幕名称”吗?在登记为“标准个人”时;参加 iPhone 开发者计划?

走过海棠暮 2024-10-13 08:31:19

感谢您的帮助,但从 iOS 6 开始,该代码段不再起作用。
不过,我用这段代码解决了这个问题。希望这有帮助

for (UIWindow* window in [UIApplication sharedApplication].windows) {
    NSArray* subviews = window.subviews;
    if ([subviews count] > 1) {
        BOOL alert = [[subviews objectAtIndex:1] isKindOfClass:[UIAlertView class]];
        BOOL action = [[subviews objectAtIndex:1] isKindOfClass:[UIActionSheet class]];

        if (alert || action)
            return YES;
    }
}
return NO;

thanx for the help, but since iOS 6, the code piece doesn't work anymore.
However, I fixed the issue with this code. Hope this helps

for (UIWindow* window in [UIApplication sharedApplication].windows) {
    NSArray* subviews = window.subviews;
    if ([subviews count] > 1) {
        BOOL alert = [[subviews objectAtIndex:1] isKindOfClass:[UIAlertView class]];
        BOOL action = [[subviews objectAtIndex:1] isKindOfClass:[UIActionSheet class]];

        if (alert || action)
            return YES;
    }
}
return NO;

iPhone:检测 UIAlert/UIActionSheet 是否打开

走过海棠暮 2024-10-13 08:13:12

这听起来很糟糕。不要存储对 Graphics 对象的引用,它仅暂时存在,并且仅在 Paint 或 PrintPage 事件处理程序运行时有效。请确保将其作为参数传递给进行绘图的任何方法,而不是将其存储在字段或全局变量中。

如果该方法正在更改对象的状态,则使用 Save() 和 Restore() 方法来防止这在使用同一对象的后续方法中引起问题。使用这种方法永远不需要克隆它。

This sounds bad. Do not store references to a Graphics object, it only ever lives temporarily and is only valid while a Paint or PrintPage event handler is running. Do make sure to pass it as an argument to whatever method does the drawing instead of storing it in a field or a global variable.

If the method is altering the state of the object then use the Save() and Restore() methods to prevent this from causing problems in subsequent methods that use that same object. Cloning it is never necessary with this approach.

如何在 C# 中克隆图形?

走过海棠暮 2024-10-13 04:16:19

您可以将表引擎更改为MEMORY,它将把完整的表存储在内存中。

You can change the table engine to MEMORY and it will store the full table in memory.

MySQL:如何将整个 myisam 表保留在内存中?

更多

推荐作者

梦年海沫深

文章 0 评论 0

liaowenxiong

文章 0 评论 0

丢了幸福的猪

文章 0 评论 0

kaipeng

文章 0 评论 0

微信用户

文章 0 评论 0

独享拥抱

文章 0 评论 0

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