我在数据库中有一个文本,它是"计算机硬件".我用那段代码拆分了
' string seperated by colons '-'
Dim info As String = strcotegory
Dim arInfo As String() = New String(3) {}
' define which character is seperating fields
Dim splitter As Char() = {"-"c}
arInfo = info.Split(splitter)
For x As Integer = 0 To arInfo.Length - 1
Response.Write(arInfo(x) & "</br> ")
Next
Run Code Online (Sandbox Code Playgroud)
但现在我想在textbox1中获得"计算机",在textbox2中获得"硬件".
请指导我
我目前正在构建PHP类,它可以生成Web表单以实现灵活性和本地化问题.我难以为下拉输入分配键和值; 出于某种原因,foreach似乎没有得到数组变量($ country_list).这是我的代码,我遇到了困难.
require_once('_include/country_list.php');
//drop down form class
class DropDown
{
function __construct ($form, $field_label, $field_name, $field_desc, $dropdown_data, $locale){
$this->form = $form;
$this->field_label = $field_label;
$this->field_name = $field_name;
$this->filed_desc = $filed_desc;
$this->dropdown_data = $dropdown_data;
$this->locale = $locale;
}
function getNotRequiredData(){
global $notReqArry; //http://stackoverflow.com/questions/1415577/accessing-variables-and-methods-outside-of-class-definitions
return $notReqArry[$this->locale];
}
function getValue(){
return $_POST[$this->field_name];
}
function dropdown(){
$selecedVal = $this->getValue();
$select_start = "<select name=\"$this->field_name\"><option value=\"\">$this->filed_desc</option>";
foreach ($this->dropdown_data as $key=>$value){
$selected = ($key == $selecedVal ? 'selected' : '');
$options = sprintf('<option value="%s" %s >%s</option>',$key,$selected,$value); …Run Code Online (Sandbox Code Playgroud) 如何运行PowerShell脚本?
powershell.exe 'C:\my_path\yada_yada\run_import_script.ps1'有或没有--noexit)除了输出文件名外,它什么都不返回.
没有错误,没有消息,没有.哦,当我添加时-noexit,同样的事情发生了,但我仍然在PowerShell中,必须手动退出.
.ps1文件应该运行程序并返回依赖于该程序输出的错误级别.但我很确定我还没有到达那里.
我究竟做错了什么?
我有一个日期时间格式的字符串:"YYYY-MM-DD HH:MM:SS".
我在我的源代码中使用它:
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"%e. %B %Y"];
NSString *test = [formatter stringFromDate:@"2010-01-10 13:55:15"];
Run Code Online (Sandbox Code Playgroud)
我想从"2010-01-10 13:55:15"转换为"2010年1月10日".但我的实施不起作用.
这有什么不对?
非常感谢提前和最诚挚的问候.
更新的源代码:
[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"%Y-%m-%d %H:%M:%S"];
NSString *test1 = [formatter stringFromDate:@"2010-01-10 13:55:15"];
NSDateFormatter *formatter1 = [[[NSDateFormatter alloc] init] autorelease];
[formatter1 setDateFormat:@"%d. %M4 %Y"];
NSString *test2 = [formatter1 stringFromDate:test1];
Run Code Online (Sandbox Code Playgroud) 在cx_Oracle(或一般的Oracle)中,是否可以为每个查询分配游标,或者在多个查询中重用游标.
def getSomeData(curs): # case 1: pass in a cursor, which is generally
curs.execute('select ...') # reused across queries
return curs.fetchall()
def getSomeData(conn): # case 2: pass in a connection,allocate
curs=conn.cursor() # a cursor for this query
curs.execute('select ...')
return curs.fetchall()
Run Code Online (Sandbox Code Playgroud)
当然,两种方法都返回相同的数据.
这两种方法之间有什么权衡?特别是效率更高还是更低?在许多查询中重用游标是否有任何潜在的缺陷?
我有一个多线程.Net C#应用程序,它使用Direct3D 9/10和XAudio2.(Direct3D仅由一个线程访问,对于XAudio2也是如此.Direct3D不是问题,因为DX9或DX10模式中的错误显示,而其行为没有任何变化.)
有时候(有些区域会随机出现这个问题)这个应用程序会以一种相当不引人注目的方式崩溃.即使应用程序是通过带有调试器的visual studio启动的,它也会崩溃而不会出现任何异常.(首先说"applicationname.svchost.exe崩溃等等.等等.你想调试吗?",如果我按下它会告诉我"你无法调试已经关闭的应用程序."
没有办法找出崩溃的原因是什么?因为我的想法已经用完了,调试器根本没有给我任何信息.没有例外,我甚至无法进行堆栈跟踪或转储.:P(我假设是一个同步问题(甚至在那个领域我认为我只做顺序工作......),但是为什么不启动异常?:|)
在出现问题的区域我正在卸载一个重新加载一系列与小说相关的类(在顺序核心线程中,所以我怀疑它可能是一个问题)并通过XAudio2开始一个新的音乐.(顺便说一下,关于XAudio2的多线程考虑是什么?从多个线程调用是否安全?)
谢谢您的帮助.
PS有一个软件附加到我的监控所有电话,并告诉我崩溃前的最后一次电话是什么?
所以遇到了一个小问题.我正在创建一个小应用程序来自动化在一个网站上提交表单.但糟糕的是,他们正在使用multipart/form-data.没有文件只上传一些文本字段用于提交.
当然这样做就失败了.
string postData1 = "firstfield="+firststring+"secondfield="+secondstring;
所以我的问题是如何将这些表单字段发布到多部分表单?
在php中发布像数组一样:
$postdata = array('firstfield' => $firststring, 'secondfield' => $secondstring);
工作并传递表单,但似乎无法使用c#
有什么建议?
数据提交通过3页(基本screenscrape)登录/ part1/part2
到目前为止我可以成功登录并发布part1(使用普通应用程序/ x-www-form-urlencoded格式)
但是当生病时尝试发布多部分表单时,它会失败并将我发回给part1.所以也许我的代码错了,但这里是:
string password = "password";
string username = "username";
string link = "http://somelink.com/";
string text = "Blah Blah some text here";
string title = "Blah Blah";
string tags1 = title;
string summary = "Blah Blah summary";
string tags = tags1.Replace(" ", ",");
// Set cookie container
CookieContainer cookieJar = new CookieContainer();
string loginData = "username=" + username + …Run Code Online (Sandbox Code Playgroud) 对于大多数Perl程序员来说,这可能是一个简单的问题,到目前为止,我只使用Perl两周,并且对Perl软件包非常不熟悉.
我有一个简单的XSD文件如下:
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="elementname">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="field1" type="xsd:integer" minOccurs="0" maxOccurs="1"/>
<xsd:element name="field2" type="xsd:string" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Run Code Online (Sandbox Code Playgroud)
我想用上面的XSD验证XML文件,以确保这是一个有效的XML.我应该使用什么Perl模块?我更喜欢在*nix上的ActivePerl和Perl上都可用的模块.发布一些代码片段会非常有帮助.
谢谢
请原谅我的无知,因为我对jquery并不熟悉.是否有相当于dojo.hitch()的东西?它返回一个保证在给定范围内执行的函数.
- 编辑 - 根据要求,这是一个例子.我经常使用hitch来确保在正确的对象中执行回调.例如,假设我调用了一个实用程序方法doSomethingAsync,并将其传递给回调函数.有了故障,我可以确保函数在特定范围内执行,即使实用程序方法执行ajax调用等等:
expectedScopeObj = {
flag: true,
callback: function(){console.debug(this.flag);},
main: function() {
// without hitch the callback function would not find flag
core.util.doSomethingAsync(dojo.hitch(this, this.callback));
}
}
Run Code Online (Sandbox Code Playgroud)
没有故障,回调函数可能在不同的范围内执行,并且this.flag在未定义的情况下会抛出错误.然而,有了障碍,它保证在内部执行execptedScopeObj.
我的应用程序是用Java编写的.我需要使用一个C++库.我不想使用JNI.
每秒60次,C++应用程序需要向Java应用程序发送10MB的数据; Java应用程序需要向C++应用程序发送10 MB的数据.
两个应用程序都在同一台机器上运行; 操作系统是Linux或Mac OS X.
最有效的方法是什么?(目前,我正在考虑TCPIP端口;但在C++中,我可以进行内存映射 - 我可以在Java中做类似的事情吗?)
谢谢!