小编Aut*_*ter的帖子

如何在Mac上使用Process.Start()或等效的Mono并传入参数

我正在尝试编写一些c#代码来启动浏览器,Process.Start(app,args);其中app是浏览器的路径,例如/Applications/Google Chrome.app/Contents/MacOS/Google Chromeargs--no-default-browser-check

如果我这样做,它适用于Windows和Linux

Process.Start("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","--no-first-run");
Run Code Online (Sandbox Code Playgroud)

我明白了

open: unrecognized option `--no-first-run'
Usage: open [-e] [-t] [-f] [-W] [-n] [-g] [-h] [-b <bundle identifier>] [-a <application>] [filenames]
Help: Open opens files from a shell.
      By default, opens each file using the default application for that file.  
      If the file is in the form of a URL, the file will be opened as a URL.
Options: 
      -a                Opens with the specified application.
      -b                Opens with the …
Run Code Online (Sandbox Code Playgroud)

c# macos mono

24
推荐指数
1
解决办法
2万
查看次数

.get()和.fetch(1)之间的区别是什么

我编写了一个应用程序,其中一部分是使用URL解析器以ReST类型的方式获取某些数据.因此,如果您将/ foo/bar作为路径,它将找到所有条形项目,如果您放置/ foo,它将返回foo下面的所有项目

所以我的应用程序有一个查询

data = Paths.all().filter('path =', self.request.path).get()
Run Code Online (Sandbox Code Playgroud)

哪个效果很好.现在我想使用模板将其发送到UI

{%for datum in data%}

{{datum.title}}

{{datum.content}}

   </div>
Run Code Online (Sandbox Code Playgroud)

{%endfor%}

当我这样做时,我得到的数据不是可迭代的错误.所以我更新了Django {% for datum in data.all %},现在它似乎比我给它提供更多的数据.它显示数据存储区中的所有数据都不理想.所以我从Django中删除了.all并将数据存储区查询更改为

data = Paths.all().filter('path =', self.request.path).fetch(1)
Run Code Online (Sandbox Code Playgroud)

现在按照我的意图运作.在文档中说

db.get()函数从数据存储区中获取Key(或Keys列表)的实体.

所以我的问题是为什么我可以在它返回fetch()但不能使用时迭代查询get().我的理解在哪里出错了?

python google-app-engine google-cloud-datastore

7
推荐指数
1
解决办法
2万
查看次数

如何在Google App Engine中获得我的某个模型的独特价值

我有一个模型,下面,我想得到所有不同的area价值观.SQL等价物是select distinct area from tutorials

class Tutorials(db.Model):  
    path = db.StringProperty()
    area = db.StringProperty()
    sub_area = db.StringProperty()
    title = db.StringProperty()
    content = db.BlobProperty()
    rating = db.RatingProperty()
    publishedDate = db.DateTimeProperty()
    published = db.BooleanProperty()
Run Code Online (Sandbox Code Playgroud)

我知道在Python中我能做到

    a = ['google.com', 'livejournal.com', 'livejournal.com', 'google.com', 'stackoverflow.com']
 b = set(a)
    b
    >>> set(['livejournal.com', 'google.com', 'stackoverflow.com'])
Run Code Online (Sandbox Code Playgroud)

但是这需要我将区域项目从查询中移动到另一个列表中,然后针对列表运行set(听起来非常低效),如果我在数据存储区中有一个位于1001位置的不同项目,我不会因为它而看到它获取限制为1000.

我希望在我的数据存储区中获取区域的所有不同值,以将其作为链接转储到屏幕上.

python google-app-engine google-cloud-datastore

5
推荐指数
1
解决办法
2029
查看次数

在"没有服务器响应"错误的构建服务器上,Selenium测试失败

我在VS2010测试项目中进行了简单的Selenium测试,如下所示.

[TestMethod]  
public void MyTestInIE8()  
{  
    IWebDriver driver = new InternetExplorerDriver();  
    try  
    {  
       driver.Navigate().GoToUrl("http://localhost/MyMVC/ABC/DoStuff");
       driver.FindElement((By.Id("Name"))).SendKeys("John");  
       //... run rest of the test  
    }  
    finally  
    {  
       driver.Quit();  
    }  
}  
Run Code Online (Sandbox Code Playgroud)

这在本地服务器上运行良好.但是在构建服务器上它失败并显示以下消息....抛出异常:OpenQA.Selenium.WebDriverException:服务器没有响应url http:// localhost:4444/session/5e5e9b7a-e05c-40d8-9a20-9cab138b2b87.

问题似乎是在finally子句中调用Quit()方法.我试图传入一个已知的端口号,即InternetExplorerDriver(8080),但它没有任何区别.Firefox驱动程序在本地和构建服务器上运行良好.我发现有人报告了类似问题,但没有找到可行的解决方案.http://groups.google.com/group/webdriver/msg/4347971da4d96e97

这是我的配置.Windows 7专业版SP1,64位.
Webdriver - selenium-dotnet-2.0b2.
IE8.

我的构建服务器是带有IE8的Windows Server2008 R2 Standard.
谢谢.

selenium internet-explorer webdriver

4
推荐指数
1
解决办法
7256
查看次数

密码的正则表达式

有些人可以通过以下规则给我正确的密码表达.

密码长度至少应为7个字符.它应包含最少3位数字和一个字母字符.密码可以接受任意次数的数字,字母,特殊字符,但数字应至少为3.

regex asp.net

0
推荐指数
1
解决办法
1749
查看次数