小编Bur*_*jua的帖子

Android上使用了哪些设计模式?

我正在对移动平台进行一项小型研究,我想知道Android中使用了哪些设计模式?

例如在iOS中,模型 - 视图 - 控制器与委托和其他模式一起被广泛使用.

哪些模式以及Android使用的具体位置?

编辑

我不是要求内核,dalvik等深入使用的设计模式,而是要求应用程序开发人员在开发应用程序时遇到的模式.

android design-patterns

257
推荐指数
9
解决办法
14万
查看次数

拒绝访问该路径

我知道这个问题在这里被多次询问过,但我无法找到解决问题的方法.我正在尝试将图像保存到.net c#中的文件夹但是得到此异常:

Access to the path 'C:\inetpub\wwwroot\mysite\images\savehere' is denied.The error occured at mscorlib because    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
Run Code Online (Sandbox Code Playgroud)

我给完全控制该文件夹(savehere)至network serviceiis_iusrs,甚至给予了充分的控制,everyone但仍然得到此异常.我尝试通过资源管理器和IIS管理器进行访问,但仍然没有运气

我在Windows Server 2008 R2和IIS 7.5上进行此操作,我需要提供哪些访问权限?

谢谢

.net c# iis path denied

155
推荐指数
9
解决办法
47万
查看次数

如何更新C#中List <>中的对象

我有一个List<>自定义对象.

我需要通过一些唯一的属性在此列表中找到一个对象,并更新此对象的另一个属性.

最快的方法是什么?

c# asp.net generics list

64
推荐指数
7
解决办法
18万
查看次数

在objective-c中创建现在为NSNumber的时间戳

我怎样才能获得时间戳NSNumber?我只需要这样的东西:1232885280

timestamp objective-c

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

当.NET抛出WebException((400)Bad Request)时如何处理WebResponse?

我正在使用Facebook Graph Api并尝试获取用户数据.我正在发送用户访问令牌,如果此令牌过期或无效Facebook返回状态代码400并且此响应:

{
    "error": {
        "message": "Error validating access token: The session is invalid because the user logged out.",
        "type": "OAuthException"
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是当我使用这个C#代码时:

try {
   webResponse = webRequest.GetResponse(); // in case of status code 400 .NET throws WebException here
} catch (WebException ex) {
}
Run Code Online (Sandbox Code Playgroud)

如果状态代码为400,则.NET抛出WebException,并且在异常被捕获之后我webResponse就是null这样,所以我没有机会处理它.我想这样做是为了确保问题是在过期的令牌中,而不是在其他地方.

有办法吗?

谢谢.

c# asp.net facebook exception httpwebresponse

37
推荐指数
2
解决办法
5万
查看次数

使用多个表的最佳实践

我在我的应用程序中使用了包含多个表的数据库.我有一个XML解析器,需要在解析时将数据写入两个表.我为这两个表创建了两个数据库适配器,但现在我遇到了问题.当我使用一张桌子时,很容易:

FirstDBAdapter firstTable = new FirstDBAdapter(mycontext);
firstTable.open(); // open and close it every time I need to insert something
                   // may be hundreds of times while parsing
                   // it opens not a table but whole DB     
firstTable.insertItem(Item);        
firstTable.close(); 
Run Code Online (Sandbox Code Playgroud)

因为它是一个SAX解析器,在我看来(也许我错了),这将更好:

FirstDBAdapter firstTable = new FirstDBAdapter(mycontext);

@Override
public void startDocument() throws SAXException 
{
    firstTable.open(); // open and close only once
}

...
firstTable.insertItem(Item);
...

@Override
public void endDocument() throws SAXException 
{
    firstTable.close();
}
Run Code Online (Sandbox Code Playgroud)

但是,如果我需要将数据插入第二个表,我该怎么做?例如,如果我有第二个适配器,我认为这将是一个坏主意:

FirstDBAdapter firstTable = new FirstDBAdapter(mycontext);
SecondDBAdapter secondTable = …
Run Code Online (Sandbox Code Playgroud)

database android android-sqlite

30
推荐指数
3
解决办法
3万
查看次数

如何在JavaScript中通过ID获取子元素?

我有以下html:

<div id="note">
<textarea id="textid" class="textclass">Text</textarea>
</div>
Run Code Online (Sandbox Code Playgroud)

我怎样才能获得textarea元素?我不能用document.getElementById("textid")

我现在这样做:

var note = document.getElementById("note");
var notetext = note.querySelector('#textid');
Run Code Online (Sandbox Code Playgroud)

但它在IE中不起作用(8)

我怎么能这样做?jQuery没问题

谢谢

javascript jquery element

29
推荐指数
2
解决办法
10万
查看次数

如何摆脱"你试图打开的解决方案必然是源控制"的消息

我有从源控制解决方案复制的Visual Studio解决方案文件.我不希望它是源代码控制的,当我打开它时,我收到消息:the solution you are trying to open is bound to source control

我删除了.vssscc文件,但仍然收到了消息.我怎么能摆脱它?

谢谢.

tfs visual-studio visual-studio-2012 tfs2012

26
推荐指数
1
解决办法
7954
查看次数

如何使用带有OWIN的web api自动托管index.html

应该是一个简单的问题,只是找不到答案.

我有一个带有web api的SPA(AngularJS),它是由Owin自己托管的.我使用Nancy来提供页面,但我想摆脱Nancy并使用Index.html作为我的单页.

我在这里看到了这个问题:如何将除Web API以外的所有内容路由到/index.html

我不能使用已接受的答案,因为我没有MVC和HomeController,在更新的问题中建议的方式也不起作用,我得到 No HTTP resource was found that matches the request URI 'http://admin.localhost:33333/'. No route providing a controller name was found to match request URI 'http://admin.localhost:33333/'

routing asp.net-web-api single-page-application owin

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

NSURLConnection不会调用委托方法

我在这里看到了类似的问题,但我无法找到解决问题的方法.我在主线程中有一个简单的NSURLConnection(至少我没有创建任何其他线程),但是我的委托方法没有被调用

[[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease];
Run Code Online (Sandbox Code Playgroud)

并且没有被称为的方法,例如

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSLog(@"didReceiveResponse");
}
Run Code Online (Sandbox Code Playgroud)

self也是NSXMLParser的委托,但我认为它不应该是一个问题,因为我在同一个项目中的其他类中工作.我已经检查了10次,但找不到任何问题.

我在这里看到了一些黑客来解决它:http://www.depl0y.com/? p = 345 但我不喜欢它,可能有人知道更好的解决方案吗?谢谢

iphone delegates nsurlconnection

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