我想知道如何使用以下命令将已排序的hasttable分配给新变量.我使用以下命令
$ht = @{
1 = "Data1";
3 = "Data3";
2 = "Data2";
}
$htSorted = $ht.GetEnumerator() | Sort-Object Name
Run Code Online (Sandbox Code Playgroud)
但是在运行之后我无法遍历生成的哈希表
foreach($key in $htSorted.Keys)
{
$item[$key]
}
Run Code Online (Sandbox Code Playgroud)
任何的想法 ?
在我的个人知识库上工作...我想格式化我的文档,甚至在wiki语法的本地硬盘上.有时我会将它们上传到(公司)维基,有时我会从那里下载它们.计划中有一些工具可以支持此流程并搜索我的知识库(文档)以供日后使用.显然,我希望降价与大多数兼容,最大限度地减少转换工作.
所以我的问题类似于这个相关的问题,但是
嗨,我想知道为了在我的网站上自行发布应用程序,我必须遵循的流程是什么.是仅将.apk文件放在网站中并提供用户导航(从手机)到应用程序并安装它的链接?
提前致谢.
我刚刚开始使用maven,我现在正在关注http://www.sonatype.com/books/mvnex-book/reference/simple-project-sect-create-simple.html上的文章:
要启动新的Maven项目,请使用命令行中的Maven Archetype插件.运行archetype:generate goal,选择原型#77,然后输入"Y"确认并生成新项目:
我的环境是:
albert@albertkam:~/java/mvn-test> mvn -v
Apache Maven 3.0.1 (r1038046; 2010-11-23 17:58:32+0700)
Java version: 1.6.0_22
Java home: /home/albert/java/jdk1.6.0_22/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.34-12-desktop" arch: "i386" Family: "unix"
Run Code Online (Sandbox Code Playgroud)
这就是我做的mvn archetype:generate(在我的情况下,似乎快速启动原型是98?)
....
98: remote -> maven-archetype-quickstart (An archetype which contains a sample Maven project.)
....
360: remote -> wikbook.archetype (-)
361: remote -> circumflex-archetype (-)
362: remote -> javg-minimal-archetype (-)
Choose a number: 98: 98
Choose version:
1: 1.0-alpha-1
2: …Run Code Online (Sandbox Code Playgroud) 什么是包含BYTE数据的数组pData[1+2*i]<<8|pData[2+2*i]在哪里pData[ ]?我在main函数中有以下功能
{
..........
....
BYTE Receivebuff[2048];
..
ReceiveWavePacket(&Receivebuff[i], nNextStep);
....
...
..
}
Run Code Online (Sandbox Code Playgroud)
其中Receivebuff是BYTE类型的数组.
ReceiveWavePacket(BYTE * pData, UINT nSize)
{
CString strTest;
for(int i = 0 ; i < 60 ; i++)
{
strTest.Format("%d\n",(USHORT)(pData[1+2*i]<<8|pData[2+2*i]));
m_edStatData.SetWindowTextA(strTest);
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道的意思" ,(USHORT)(pData[1+2*i]<<8|pData[2+2*i]).
任何人都可以帮帮我吗?
dic1 = {'a':'a','b':'c','c':'d'}
dic2 = {'b':'a','a':'c','c':'d'}
dic1.keys() =>['a', 'b', 'c']
dic2.keys() =>['b', 'a', 'c']
Run Code Online (Sandbox Code Playgroud)
dic1和dic2具有相同的键,但顺序不同.
如何判断他们有相同的密钥(不考虑订单)?
When I try to click the menu action button in QLPreviewController the application crashes.
Run Code Online (Sandbox Code Playgroud)
这就是我在委托方法中所做的
- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)index
{
NSMutableString*Url = [[NSMutableString alloc] initWithFormat:@"http://10.30.24.21/Documents/abc.doc];
NSURL *fileURL;
fileURL = [NSURL URLWithString:Url];// the url of the file which is present in NAS device
[Url release];
return fileURL;
}
Run Code Online (Sandbox Code Playgroud)
这是崩溃报告
2011-01-11 12:21:36.717 iLink[5548:207] *** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UIDocumentInteractionController.m:1060
2011-01-11 12:21:36.720 iLink[5548:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController: invalid scheme https. Only the file scheme is supported.' …Run Code Online (Sandbox Code Playgroud) 我已编写此代码以查看Outlook邮箱中的未读项目,以下是代码:
Microsoft.Office.Interop.Outlook.Application app;
Microsoft.Office.Interop.Outlook.Items items;
Microsoft.Office.Interop.Outlook.NameSpace ns;
Microsoft.Office.Interop.Outlook.MAPIFolder inbox;
Microsoft.Office.Interop.Outlook.Application application = new Microsoft.Office.Interop.Outlook.Application();
app = application;
ns = application.Session;
inbox = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
items = inbox.Items;
foreach (Microsoft.Office.Interop.Outlook.MailItem mail in items)
{
if (mail.UnRead == true)
{
MessageBox.Show(mail.Subject.ToString());
}
}
Run Code Online (Sandbox Code Playgroud)
但在foreach循环中我收到此错误:
"无法将类型为'System .__ ComObject'的COM对象转换为接口类型'Microsoft.Office.Interop.Outlook.MailItem'.此操作失败,因为QueryInterface调用COM组件上的接口与IID'{00063034-0000- 0000-C000-000000000046}由于以下错误而失败:不支持此类接口(HRESULT异常:0x80004002(E_NOINTERFACE)).
你能帮我解决一下这个错误吗?
我正处于"学习MVC"方式的开端.基本上,我没有面向对象编程的大问题,但是有一个技术方面需要澄清.看来我的理论还不够好.
目前,我正在使用KohanaPHP框架,版本3.
示例情况:我有一个网站,用户可以在其中提交文章.
所以我有以下结构:
classes/
/controllers/
article.php
/models/
articles.php
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好.我对扩展Kohana_Model的模型没有问题但是我不确定我是否使用正确使用ORM的方式模型.
基本上当使用扩展Kohana_Model的模型时,我会将所有逻辑运算放在模型中.对于使用ORM的模型,我应该这样做吗?在网上的许多例子中,我看到控制器正在对来自数据库的用户输入/数据执行逻辑操作,这在我看来是不正确的.
假设我需要从数据库中获取几行,因此我在模型中创建了正确的方法并返回了对象.我认为这是对的,不是吗?
基本上,所有关于用户输入/数据的操作(从db中选择,插入到db,验证)我都放入模型中.这就是我理解MVC设计模式的方式.模型应该关注所有"机械"操作,控制器只是模型/视图之间的"桥梁",它是一个"前端"引擎.
这是一种正确的方法吗?
我知道对于更高级的用户来说这可能是一个愚蠢的问题,但我想只学习好的做法.如果有人能提供一些澄清,我会很高兴.
我想在我的Android应用程序上实现bonjour/zero conf.我正在使用jmDns库来搜索所有可用的设备.以下是我用于搜索同一网络中的设备的代码:
public class ListDevices extends ListActivity {
JmDNS jmdns;
JmDNSImpl impl;
MulticastLock lock;
protected ServiceListener listener;
protected ServiceInfo info;
public ListView lv;
public ArrayList<String> deviceList;
public int cancel = 0;
public final static String TAG = "ListDevices";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
deviceList = new ArrayList<String>();
showAllPrinters();
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, deviceList));
lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long …Run Code Online (Sandbox Code Playgroud)