小编cdu*_*dub的帖子

让一个控制器函数在CakePHP 1.2中调用不同的控制器函数

如何让我的Search控制器doSearch()内部具有调用getTitles()功能的Titles控制器功能?

controller cakephp cakephp-1.2

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

ASP.NET Web控件中的Html编码

我有一个名为TopicTree.ascx.cs的文件,我试图输出编码的字符串,如下所示:

            string subject = reader.IsDBNull(0) ? string.Empty : reader.GetString(0);
            string topic = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);

            subject = subject.Trim();
            topic = topic.Trim();

            string en_subject = Server.HtmlEncode(subject);
            string en_topic = Server.HtmlEncode(topic);

            string output = string.Format("<li><a href=\"searchresults.aspx?type=topics&subject={1}&topic={2}\" style=\"cursor: pointer;\">{0}</a></li>", topic, en_subject, en_topic);
Run Code Online (Sandbox Code Playgroud)

但是当我实际看到屏幕上的输出时,它没有被编码.怎么了?

c# asp.net string html-encode

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

如何更改ASP.NET中DropDownList中的项目

我有这个在我的代码背后绑定:

 <asp:DropDownList id="ddlPopulation" runat="server" DataTextField="population" DataValueField="pid" AppendDataBoundItems="True">
<asp:ListItem>Default</asp:ListItem>
Run Code Online (Sandbox Code Playgroud)

如何更改后面代码中的列表项?我想在它们呈现给用户之前做一个Html_Decode并修剪它们?

DataBind代码是:

 StringBuilder sql = new StringBuilder();

    // Define sql
    sql.Append("SELECT DISTINCT datasource ");
    sql.Append("FROM meta ");
    sql.Append("WHERE datasource != '' ");
    sql.Append("ORDER BY datasource ASC ");

    IDataReader reader = SqlHelper.GetDataReader(sql.ToString());

    ddlDatasources.DataSource = reader;
    ddlDatasources.DataBind();
Run Code Online (Sandbox Code Playgroud)

c# asp.net databound

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

Facebook的图像缩略图共享一个链接

每次我从我的网站http://reviewsie.com上分享Facebook上的链接时,都会选择Twitter缩略图作为图像缩略图.(这也发生在pinterest和我的一些广告工具中.​​)如何使某个图像脱颖而出并正确选择?

html css facebook image

2
推荐指数
2
解决办法
7621
查看次数

跟踪 SQL 异常

我在客户端的生产服务器上发生了 SQL 异常(我在其中几乎没有权限)。

我无法在本地复制问题,但是有什么好的方法可以获取并找出正在调用哪个 sql 异常以及使用哪个 sql 吗?我可以重新部署并有权更改源代码。

我的堆栈跟踪是这样的:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:
[SqlException (0x80131904):  ]

System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950954
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846939
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
System.Data.SqlClient.SqlDataReader.CloseInternal(Boolean closeReader) +169
System.Data.SqlClient.SqlDataReader.Close() +96
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) …
Run Code Online (Sandbox Code Playgroud)

c# asp.net iis debugging sql-server-2005

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

标签和UIFont上的ios 7排版

我有以下代码:

UILabel *registerLabel = [ [UILabel alloc ] initWithFrame:CGRectMake(20.0, 90.0, [self screenWidth], 43.0) ];
registerLabel.textAlignment =  NSTextAlignmentLeft;
registerLabel.textColor = [UIColor whiteColor];
registerLabel.backgroundColor = [UIColor blackColor];
registerLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:(20.0)];
//registerLabel.adjustsFontSizeToFitWidth = YES;
registerLabel.text = @"Register";
Run Code Online (Sandbox Code Playgroud)

但我在一些ios 7演示应用程序(如日历)中看到字体很大但更薄.我尝试使用Helevetica Neue Light,但这不起作用.有没有办法让字体变薄或使用什么字体?

fonts typography uifont ios ios7

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

在iOS 7中设置方向

我的uiviewcontroller.m文件中有以下代码:

-(BOOL)shouldAutoRotate
{
    return YES or NO;
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试了YES和NO,但我的视图控制器仍在旋转?我使用的是iOS 7,我发现的其他iOS解决方案也不适用于我.

orientation uiviewcontroller uinavigationcontroller ios ios7

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

如何阻止UIScrollView到达底部时滚动

我有以下代码来获取UIScrollView到达其内容视图结束时的事件:

- (void) scrollViewDidEndDecelerating:(UIScrollView *) scrollView
{
    float currentEndPoint = scrollView.contentOffset.y + scrollView.frame.size.height;

    // CGPoint bottomOffset = CGPointMake(0, scrollView.contentSize.height - scrollView.bounds.size.height);
    // [scrollView setContentOffset:bottomOffset animated:NO];

    if (currentEndPoint >= scrollView.contentSize.height)
    {
        // We are at the bottom
Run Code Online (Sandbox Code Playgroud)

我注意到当我滚动到底部时它会撞到它并反弹回来.

如果我添加这个:

CGPoint bottomOffset = CGPointMake(0, scrollView.contentSize.height - scrollView.bounds.size.height);
[scrollView setContentOffset:bottomOffset animated:NO];
Run Code Online (Sandbox Code Playgroud)

然后滚动回到底部.

是否有任何方法让它保持在底部没有"反弹",因为一旦它击中底部,阻止它移动.

谢谢.

objective-c uiscrollview ios setcontentview ios8

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

ios 9 objective-c屏幕尺寸问题

我升级到ios 9和xcode 7(来自xcode 6.2),现在当我启动应用程序时会发生这种情况:

在此输入图像描述

现在上面和下面都有这些黑条.

我的appDelegate是这样的:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.
    // self.window.backgroundColor = [UIColor whiteColor];
    // [self.window makeKeyAndVisible];



    _startViewController = [[StartViewController alloc] init];
    _startNavigationController = [[StartNavigationController alloc] initWithRootViewController:_startViewController];
    self.window.rootViewController = _startNavigationController;
    [self.window makeKeyAndVisible];

    // Need to fix this since deprecated
    // [application prefersStatusBarHidden:NO];
    // [application preferredS :UIStatusBarStyleDefault];

    // [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    return YES;
}    
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios swift ios9

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

生成带有虚线填充线的 SVG 矩形

我有一个用dimpleJS 制作的矩形,需要用虚线而不是纯色填充框。这可以使用 svg、css 和/或 jquery 吗?矩形如下。

<rect id="dimple-not-working-on-an-associate-s-degree-2008-not-working-on-an-associate-s-degree---" class="dimple-series-0 dimple-bar dimple-not-working-on-an-associate-s-degree dimple-2008 dimple-not-working-on-an-associate-s-degree dimple-custom-series-bar dimple-custom-format-1" x="183.5" y="128.4" width="18" height="141.6" opacity="0.8" style="fill: rgb(92, 186, 230); stroke: rgb(77, 156, 192);" fill="#5cbae6" stroke="rgb(77, 156, 192)"></rect>
Run Code Online (Sandbox Code Playgroud)

css jquery svg dimple.js

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