我试图'模拟'重启(或其他任何事情adb shell am),我无法弄清楚如何引用我的组件.然后,也许我甚至不理解组件的含义.下面我首先包括一些不起作用的示例命令,然后是我的清单.请注意,"手机"启动时会成功调用StartupReceiver.我只想在没有完全重启的情况下重新触发它.
ADB命令失败:
$ ./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android.StartupReceiver
<help snipped>
Error: Bad component name: net.fstab.checkit_android.StartupReceiver
$ ./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n .StartupReceiver
<help snipped>
Error: Bad component name: .StartupReceiver
$ ./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n StartupReceiver
<help snipped>
Error: Bad component name: StartupReceiver
Run Code Online (Sandbox Code Playgroud)
表现:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.fstab.checkit_android" android:installLocation="internalOnly"
android:versionCode="1" android:versionName="1.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".BaseActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" /> …Run Code Online (Sandbox Code Playgroud) 在循环的每次迭代中,我正在计算MATLAB矩阵.这些矩阵必须连接在一起以创建一个最终矩阵.在进入循环之前我知道这个最终矩阵的维数,所以我使用'零'函数预先分配矩阵比初始化一个空数组要快,然后在循环的每次迭代中简单地附加子数组.奇怪的是,当我预分配时,我的程序运行得慢得多.这是代码(只有第一行和最后一行不同):
这很慢:
w_cuda = zeros(w_rows, w_cols, f_cols);
for j=0:num_groups-1
% gets # of rows & cols in W. The last group is a special
% case because it may have fewer than max_row_size rows
if (j == num_groups-1 && mod(w_rows, max_row_size) ~= 0)
num_rows_sub = w_rows - (max_row_size * j);
else
num_rows_sub = max_row_size;
end;
% calculate correct W and f matrices
start_index = (max_row_size * j) + 1;
end_index = start_index + num_rows_sub - 1;
w_sub = W(start_index:end_index,:);
f_sub …Run Code Online (Sandbox Code Playgroud) 嗨,我有一个领域模型,用于Django应用程序,我想在一个表单上呈现.我用自定义的ModelForms创建了我的应用程序(没有太多变化,一些字段被排除在外等).模型的依赖关系如下:
Complaint
\
.--- CarInfo
.--- Customer
Run Code Online (Sandbox Code Playgroud)
我的视图功能如下所示:
def make(request):
if request.method == 'POST':
parameters = copy.copy(request.POST)
complaint = Complaint()
carInfo = CarInfo()
customer = Customer()
customer_form = CustomerForm(parameters, instance=customer)
carInfo_form = CarInfoForm(parameters, instance=carInfo)
parameters['complaint_date'] = get_current_date()
parameters['customer'] = 1 # dummy value to allow validation success
parameters['car_info'] = 1 # dummy value to allow validation success
form = ComplaintForm(parameters, instance=complaint)
if form.is_valid() and customer_form.is_valid() and carInfo_form.is_valid():
carInfo_form.save()
customer_form.save()
parameters['customer'] = customer.id
parameters['car_info'] = carInfo.id
form = ComplaintForm(parameters, instance=complaint)
form.save() …Run Code Online (Sandbox Code Playgroud) 我是MongoDB的新手,所以请耐心等待.
我有两个问题:
首先,请采取以下措施:
// add a record
$obj = array( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" );
Run Code Online (Sandbox Code Playgroud)
MongoDB是否将"title"和"author"存储为此集合中此对象的每个条目的文本?或者它是否创建了一个模式并将它们转换为字段数(或者根本没有存储并纯粹存储数据)?
我的第二个问题是:什么时候应该使用"关系"?假设我有100个经销商,每个经销商包含(对象)1,000个客户,每个客户有10个项目.这使得一个巨大的整体对象可以操纵.
在SQL世界中,这都是相关的"对象".在Document world中,我们尝试通过嵌入子对象来存储完整的对象.
但是,这可能很笨拙.这是什么最好的做法?有人可以指点我的指南.
谢谢.
我想request.method应该返回一个符号一样:get,:put等等?但是在控制器动作中,我得到的GET是一个字符串!
难道我做错了什么?
在routes.rb:
resources :posts
member do
get 'some_action'
end
end
Run Code Online (Sandbox Code Playgroud)
在.erb视图中:
<%= link_to "Some Action",some_action_post_path %>
Run Code Online (Sandbox Code Playgroud)
在PostsController:
def some_action
p request.method # => "GET"
p request.method.class.name # => "String"
if request.method == :get
#does not get called
end
end
Run Code Online (Sandbox Code Playgroud)
PS.我在Ruby 1.8.7 p330上使用Rails 3.0.3
大家.当用户到达列表底部时,我想显示"Loading ..."这样的页脚.现在我只能确定我们何时在最后一个元素上.然后麻烦来了.我们需要在设置适配器之前设置页脚,我们需要在之后隐藏它.有人有解决方案吗?可能已经讨论过这个问题,但我还没有找到答案.
我有一个自定义的View类,它构建了UIView的子类.
此视图通过ViewController中的nib文件加载:
[[NSBundle main] loadNibNamed:@"MyCustomView" owner:self options:nil];
Run Code Online (Sandbox Code Playgroud)
在MyCustomView.h里面(它正确地连接在IB作为主视图类)我有一些链接的子视图属性:
@interface MyCustomView : UIView <UITextFieldDelegate> {
....
@public
UIView *backgroundLayer; // a subview of the Main View inside the nib
....
}
@property (nonatomic, retain) IBOutlet UIView *backgroundLayer;
Run Code Online (Sandbox Code Playgroud)
此插座在Interface Builder中正确连接.
在MyCustomView.m中,我有以下实现:
#import <quartzcore/QuartzCore.h>
@implementation MyCustomView
@synthesize backgroundLayer;
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
....
self.backgroundLayer.layer.cornerRadius = 12.0f;
self.backgroundLayer.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.backgroundLayer.layer.maskToBounds = YES;
....
}
Run Code Online (Sandbox Code Playgroud)
NONE这些backgroundLayer.layer设置被应用.当我在模拟器中运行时,自定义视图会出现在它没有任何这些模块的NIB中的显示方式吗?我错过了什么?我在错误的地方打电话了吗?
让我们考虑这两种编写相同代码的方法:
方法1
<div id="header">
<div id="user">
<a id="userName">Username</a>
<a id="userImage">Userimage</a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
方法2
<div id="header">
<div class="user">
<a class="name">Username</a>
<a class="image">Userimage</a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
方法1的CSS
#userName { color: white; }
#userImage { height: 50px; width: 50px; }
Run Code Online (Sandbox Code Playgroud)
方法2的CSS
#header div.user a.name { color: white; }
#header div.user a.image { height: 50px; width: 50px; }
Run Code Online (Sandbox Code Playgroud)
在我看来,方法2更干净,因为你永远不会得到像这样的ID userImageInnerBox.从技术上讲,哪种方法最好,为什么?
我需要在SharePoint 2010中为声明用户执行搜索模拟.为了说明这一点,我想首先说明如何使用Windows帐户,然后讨论Claims/WIF.
我可以使用以下方法为"经典"Windows集成身份验证用户执行此操作:
WindowsImpersonationContext wic = null;
try
{
WindowsIdentity impersonatedUser = new WindowsIdentity("john.doe@mydomain");
wic = impersonatedUser.Impersonate();
// do impersonated work here...
// in my case this is a SharePoint KeywordQuery
}
finally
{
if (wic != null)
{
wic.Undo();
}
}
Run Code Online (Sandbox Code Playgroud)
为了使上述功能得以实现,模拟帐户必须与当前用户位于同一个域中,我必须确保应用程序池所有者是:
(注意:如果有人可以弄清楚如何解决当前帐户必须与模拟帐户位于同一域中的问题,我很满意.)
我想对Claims/WIF帐户做同样的事情.这些帐户并不一定与AD帐户(我需要承担他们不是)相关联.
有没有办法告诉STS我想冒充某个特定帐户并为它提供该帐户的相应令牌?我没有我冒充用户的密码.
引用SharePoint Brew我必须应对在SharePoint Web前端(WFE)上运行的代码,该代码通过WCF调用调用查询处理器.我希望WCF调用位于模拟用户的上下文中.
WFE(Server1)搜索Web部件与服务应用程序代理进行通信.关联的搜索服务应用程序代理调用本地STS以获取用户的SAML令牌.收集SAML令牌后,搜索服务应用程序代理将通过WCF调用调用运行查询处理器的服务器.我将这个服务器称为"服务器2".服务器2接收传入请求并根据其本地STS验证SAML令牌.经过验证,Server 2连接到各种组件以收集,合并和安全性修剪搜索结果.服务器2将修剪后的搜索结果发送回服务器1,然后将其呈现给用户.
更多的研究使我看到ActAs和OnBehalfOf.我相信我会想要使用OnBehalfOf,但我不确定是否会有效.我发现的一些参考文献列在下面.任何指导表示赞赏.
我在db中有一个datetime列,当我测试它时
DateTime dateTime = DateTime.Now;
state.LastUpdated = dateTime;
Assert.AreEqual(dateTime , state.LastUpdated);
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
Assert.AreEqual failed. Expected:<3/2/2011 9:52:32 AM>. Actual:<3/2/2011 9:52:00 AM>.
SQL日期时间的粒度是多少,是否可以调整它以获得更多粒度?
android ×2
adb ×1
ado.net ×1
arrays ×1
cocoa-touch ×1
css ×1
django ×1
django-forms ×1
html ×1
ios4 ×1
iphone ×1
matlab ×1
memory ×1
mongodb ×1
performance ×1
sharepoint ×1
sql ×1
t-sql ×1
uiview ×1
wif ×1