WordPress Limit on Length and/or Captions

•November 2, 2010 • Leave a Comment

I was having issues with WordPress page being blank after adding so many characters or captions.  It was easy to replicate time and time again.  I found a lot of people with the same issue and found a few lengthy solutions.  The one I choose was easy and it worked:


/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/** Number of saved revisions; false = 0 */
define('WP_POST_REVISIONS', 10);

/** Trick for long posts */
ini_set('pcre.recursion_limit',20000000);
ini_set('pcre.backtrack_limit',10000000);

This code was added to the wp-config.php file, just after the DB_Collate entry. Once that was added, i refreshed the page it worked instantly after re-saving the page. Found this information on WordPress.org forums. The revision code was optional but will keep your database from growing, set the number of revisions you wish, i used 10.

Apache .htaccess Rules and Suggestions

•October 7, 2010 • Leave a Comment

I found these sites to be extremely helpful the other day!


htaccess ErrorDocument Examples
ErrorDocument Usage and Info

 

STATUS CODE LIST

401 Unauthorized
The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.47) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity might include relevant diagnostic information. HTTP access authentication is explained in “HTTP Authentication: Basic and Digest Access Authentication” [43].

403 Forbidden
The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.

404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

ErrorDocument 500 http://foo.example.com/cgi-bin/tester
ErrorDocument 404 /cgi-bin/bad_urls.pl
ErrorDocument 401 /subscription_info.html
ErrorDocument 403 “Sorry can’t allow you access today

Click here for the entire article!


htaccess rewrite, htaccess

 

An attempt to create a default skeleton .htaccess file with the very best apache htaccess examples… Updated semi-frequently based on detailed info from the Apache htaccess tutorial.

If you see any room for improvement, or if you can add something than go ahead and comment and I will definately give

http://www.askapache.com/htaccess/ultimate-htaccess-file-sample.html

Display CheckBoxList Selections

•July 26, 2010 • Leave a Comment

I was needing to do a CheckBoxList that would talley up the results, and show a graphic if nothing was checked, and hide the graphic if something was checked. I found the following somewhere and tweaked it a little:

  Sub Check(ByVal sender As Object, ByVal e As EventArgs)
        Dim i As Object

        Label4.Text = "<p>Selected Item(s):</p>"

        For i = 0 To txtCheckBox.Items.Count - 1

            If txtCheckBox.Items(i).Selected Then
                Image6.Visible = False
                Label4.Text += txtCheckBox.Items(i).Text + "<br />"
            ElseIf i = 0 Then
                Image6.Visible = True
            End If

        Next
    End Sub

     <asp:CheckBoxList ID="txtCheckBox" runat="server" TextAlign="left" AutoPostBack="True" OnSelectedIndexChanged="Check">
                        <asp:ListItem Text="One" />
                        <asp:ListItem Text="Two" />
                        <asp:ListItem Text="Three" />
                        <asp:ListItem Text="Four" />
       </asp:CheckBoxList>
                 
                    <asp:Label ID="Label4" runat="server" Text=""></asp:Label>
                    <asp:Image ID="Image6" runat="server" Visible="True" ImageUrl="img/ValidateWarning.png" />

AutoPostBack Refreshes to Top of Page

•July 23, 2010 • 1 Comment

When you have form elements that have AutoPostBack = TRUE, it usually will take the visitor back to the top of the page when executed.

To keep the page at it’s current spot add the following to the web.config:

<configuration>
<system.web>
<pages smartNavigation="true">
</system.web>
</configuration> 

This may be deprecated and a new way is available. Mainly works in IE and may cause problems when using javascript and dhtml scripts as they will not be rendered again while using smartnavigation according to another blog.

See SetFocus

Using Controls and Datasources from different ContentPlaceHolders

•July 18, 2010 • Leave a Comment

If you have a SqlDataSource control and a combobox on one contentplaceholder, and the gridview and datasource on another contentplaceholder, you will have problems associating the combobox to filter the gridview if you don’t use the example below to call the taget contentplaceholder and put a “$” between it and the controlID of the combobox…

 <asp:SqlDataSource       ... >
        <SelectParameters>
            <asp:ControlParameter ControlID="TheContentPlaceHolderID$TheControID" ... />
        </SelectParameters>
</asp:SqlDataSource>

ASP VB.NET CheckBox CheckedChanged Event

•July 17, 2010 • Leave a Comment

Here’s a small example of how to make a checkbox change a label property:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:CheckBox ID="CheckBox1" runat="server" Text="Make the Label Change!" AutoPostBack="True" />
        <br />
        <br />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    </div>
    </form>
</body>
</html>

Here’s the VB Codebehind:


Partial Class Default2
    Inherits System.Web.UI.Page

    Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            Label1.ForeColor = Drawing.Color.Red
            Label1.Text = "This is True and Red"
        Else
            Label1.ForeColor = Drawing.Color.Green
            Label1.Text = "This is Else<br /> and Green"
        End If
    End Sub
End Class

Open Table in SQL Server 2008 Management Studio?

•July 2, 2010 • 2 Comments

This information was gathered after many searches to find out how to open a stupid table in table view instead of design view.  I found this information on some random which answered my questions:

When you start to use Sql Server Management Studio 2008 maybe the first change you’ll realize is Select Top 1000 Rows and Edit Top 200 Rows commands instead of Open Table command in 2005. If you want to change 200 and 1000 parametric you can change these parameters by Tools>Options>SQL Server Object Explorer> Commands.  When Commands is selected you can change the functionality of these commands by changing related values.  You can make these commands work for entire table by setting values to ‘zero’. 

To open the table like you once could: choose ‘Edit Top XXX Rows’ instead of ‘Select Top XXX Rows’.  This will open the table in the familiar “Table View”.

Palm to Face… I can’t believe I didn’t put that one together before searching all over the internet looking for that old familiar “Open Table” command…