所有具体类都必须实现抽象函数.
有时您希望强制所有派生类实现抽象函数,甚至是具体类的派生.
class Base { protected abstract Base Clone(); }
class Concrete : Base { protected override Base Clone(){...}; }
class Custom : Concrete {}
Run Code Online (Sandbox Code Playgroud)
我希望编译器告诉程序员该类Custom需要实现Clone().有办法吗?
有没有人能够成功实现服务以向FlashPlayer提供所需的套接字策略文件?
我正在运行Adobe提供的服务的Python实现
http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html
Run Code Online (Sandbox Code Playgroud)
并使用以下策略文件:
<?xml version="1.0" encoding="UTF-8"?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
</cross-domain-policy>
Run Code Online (Sandbox Code Playgroud)
并从Flash接收此消息:
[SecurityErrorEvent type="securityError" bubbles=false
cancelable=false eventPhase=2
text="Error #2048:
Security sandbox violation: http://www.mapopolis.com/family/Tree.swf
cannot load data from www.mapopolis.com:1900."]
Run Code Online (Sandbox Code Playgroud)
谢谢.
我需要知道应用程序设置(连接字符串)的存储位置和方式,以便在运行时更改它们并保存.
我知道在VS中你可以配置项目>属性下的设置,这些设置存储在apps安装目录下的appname.exe.config文件中.但是"应用程序范围"在运行时不能读/写,如果你改变那些在用户范围下,配置文件的副本在用户目录下创建,并且不会被应用程序的其他用户访问.
我需要有一种方法,以便用户可以根据应用程序内部的需要配置存储在公共配置文件中的连接字符串,然后让所有其他用户(在该计算机上)也可以使用它.我该怎么做到这一点?
我的网关在购买时向我的服务器发送(发布)xml数据馈送.XML看起来像这样:
<?xml version='1.0' standalone='yes'?>
<foxydata>
<datafeed_version>XML FoxyCart Version 0.6</datafeed_version>
<transactions>
<transaction>
<id>616</id>
<transaction_date>2007-05-04 20:53:57</transaction_date>
<customer_id>122</customer_id>
<customer_first_name>Dirk</customer_first_name>
<customer_last_name>Gently</customer_last_name>
<shipping_total>4.38</shipping_total>
<order_total>24.38</order_total>
<order_total>24.38</order_total>
<customer_password>1aab23051b24582c5dc8e23fc595d505</customer_password>
<custom_fields>
<custom_field>
<custom_field_name>My_Cool_Text</custom_field_name>
<custom_field_value>Value123</custom_field_value>
</custom_field>
</custom_fields>
<transaction_details>
<transaction_detail>
<product_name>foo</product_name>
<product_price>20.00</product_price>
<product_quantity>1</product_quantity>
<product_weight>0.10</product_weight>
<product_code></product_code>
<subscription_frequency>1m</subscription_frequency>
<subscription_startdate>2007-07-07</subscription_startdate>
<next_transaction_date>2007-08-07</next_transaction_date>
<shipto>John Doe</shipto>
<category_description>Default for all products</category_description>
<category_code>DEFAULT</category_code>
<product_delivery_type>shipped</product_delivery_type>
<transaction_detail_options>
<transaction_detail_option>
<product_option_name>color</product_option_name>
<product_option_value>blue</product_option_value>
<price_mod></price_mod>
<weight_mod></weight_mod>
</transaction_detail_option>
</transaction_detail_options>
</transaction_detail>
</transaction_details>
<shipto_addresses>
<shipto_address>
<address_name>John Doe</address_name>
<shipto_first_name>John</shipto_first_name>
<shipto_last_name>Doe</shipto_last_name>
<shipto_address1>2345 Some Address</shipto_address1>
<shipto_address2></shipto_address2>
<shipto_city>Some City</shipto_city>
<shipto_state>TN</shipto_state>
<shipto_postal_code>37013</shipto_postal_code>
<shipto_country>US</shipto_country>
<shipto_shipping_service_description>DHL: Next Afternoon</shipto_shipping_service_description>
<shipto_subtotal>52.15</shipto_subtotal>
<shipto_tax_total>6.31</shipto_tax_total>
<shipto_shipping_total>15.76</shipto_shipping_total>
<shipto_total>74.22</shipto_total>
<shipto_custom_fields>
<shipto_custom_field>
<shipto_custom_field_name>My_Custom_Info</shipto_custom_field_name> …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个打开窗口的功能,但确保相同的窗口尚未打开.我希望能够传递一个非实例化的var或一个实例化的var,它可以以任何方式工作.如果窗口已经打开,它将关闭它然后重新打开它.
所以我需要一种方法来传递Window类型的变量或子类,如果它,并实例化适当的子类.
我正在寻找这样的东西:
public function openWindowOnce(window:Window):void
{
if(isOpen(window))
{
closeIfOpen(window);
}
window = new Window(); /**<-- THIS LINE window can also be a sublcass of window,
* I want to instatiate the correct sublass,
* I also want to make sure that it is a Window or a
* Sublcass of window before I instatiate it.
*/
window.open();
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
我想编写一个可以访问数据库中的表的应用程序.我把QSqlTableModel作为表的模型组件.
QTableView的问题在于它似乎没有返回表中当前所选记录的方法,所以我采用了QTableWidget类来交换QTableView.
但是当我尝试使用 - > setModel()将模型设置为此表小部件时,我得到了
以下错误消息:
c:/ Qt/qt/include/QtGui /../../ src/gui/itemviews/qtablewidget.h:337:错误:`virtual void QTableWidget :: setModel(QAbstractItemModel*)'是私有的.
消息说方法"setModel"是私有的.查看文档告诉我它是公开的.
我能做什么?
我正在为我的控制器编写一个rspec测试,但我找不到解决问题的方法.对于其中一个边缘案例测试,我需要验证一个实例变量的值.如何在不必定义访问者的情况下访问它?通常默认情况下:
controller.variable.should == '3.15'
Run Code Online (Sandbox Code Playgroud)
不起作用.
定义
attr_reader:变量
只是让测试通过将是愚蠢的,我敢肯定有一个更智能的方式.
关于这个问题,我实际上正处于为我的一个项目找到合适的HTTP容器的阶段.我查看了几个容器,但我仍然不确定哪一个最适合高负载AJAX请求.Apache Mina看起来非常有前途,但也相对复杂.名为AsyncWeb的异步Web服务器实现似乎已经与Mina合并,但我找不到它的任何生产方法.在另一个问题中,我推荐了我非常喜欢的简单HTTP服务器,因为它简单,清晰,干净,但我仍然不知道它是否符合目的.
另外,我不确定选择哪个请求处理概念:
为每个传入连接创建一个调度程序线程(优化当然可能包括一个线程池和一个调度队列),即完成所有工作.优点可能是,我不必处理那么多同步问题,但它可能会大大降低高负载的吞吐量.
因为它将是一个高度模块化的应用程序"流水线"(我猜可能有一个更合适的术语;)方法也可以工作:创建固定数量的线程,每个线程用于某个任务.例如,一个用于请求处理 - >一个用于头部反序列化(如果我以不同的格式输入,如提交的HTML表单,XML-RPC,JSON等) - >一个用于"控制器调度"(做我想对这些数据做的任何事情) ) - >和一个用于以所需格式(JSON,XML,HTML等)序列化输出,并将每个请求移动到这些级别,直到它完成.可能更难以实现,但我有固定数量的线程(数量也可以依赖于硬件)和关注点的清晰分离.
任何可能适合的框架的经验和两种不同的处理方法?
我需要检查where子句在整数范围内的表达式结果.
点赞这个:
select * from table where (col1 / col2 ) in (1..8).
Run Code Online (Sandbox Code Playgroud)
随着(1..8)表示整数范围.
我的意思是它必须是整数,而不是浮点数.所以我不能使用between 1 and 8,因为1.2将是正确的.
使用svn:ignore属性,有没有一种方法可以根据我不想忽略的模式指定我想要忽略的内容?换句话说,我想忽略除了 .xyz结尾的文件之外的所有内容.我该怎么做呢(如果可能的话)?
我探索的一个选项是提交我想要版本化的所有内容,然后将目录上的svn:ignore属性设置为'*',这意味着没有其他文件,但我已经提交的内容将被版本化.这是我能想到的最好的,但它感觉很脏,如果我确实需要添加另一个文件作为版本,我必须进行多次提交...一个删除svn:ignore属性,另一个添加/提交新文件,然后第三个更改svn:忽略回'*'.
你的意见?
.net ×2
sql ×2
actionscript ×1
air ×1
apache-flex ×1
appsettings ×1
asynchronous ×1
c# ×1
c++ ×1
controller ×1
flash ×1
http ×1
java ×1
oracle ×1
php ×1
policy ×1
qt ×1
rspec ×1
rules ×1
security ×1
sockets ×1
svn ×1
svnignore ×1
xml ×1