Need help posting code.

Need help posting code.

Old forum URL: forums.lhotka.net/forums/t/8145.aspx


rxelizondo posted on Monday, December 14, 2009

Hello,

Could someone please tell me what’s the trick to posting code on the forum?

I tried posting raw code and it’s not posted correctly, I tried escaping all the special characters but that didn’t work either. I am sure its something really stupid but I am not getting it.

I tried it with Google Chrome and Internet Explorer (ver 6 and 8) and none of them worked.

-------

On another note. Rocky, what about upgrading the newsgroups to a newer version? I think the community server is now on version 5, I have not played around with the newest version but it may have some cool things on it. No big deal, just a suggestion.

JoeFallon1 replied on Monday, December 14, 2009

I copy/paste from Visual Studio.

The code loses its indentation and gets double spaced.

I often fix it in the post by hand if it is small enough.

The trick to removing the double spacing is to delete the blank line and then press Shift-Enter to get single line spacing.

I do not know of any way to paste into this forum without manually adjusting the code.

Joe

 

rsbaker0 replied on Monday, December 14, 2009

I have trouble with this also.

The best thing I have so far come up with is to wrap the code with the "pre" and "/pre" tags (use the standard angle brackets for the quotes marks).

At least this will keep your code from being mangled. Here is a sample:


///Status property description
public GaugeStatuses Status
{
get { return GetProperty(StatusProperty); }
set { SetProperty(StatusProperty, value); }
}


rxelizondo replied on Monday, December 14, 2009

Cool, let me try this my self:




private static PropertyInfo NameProperty = RegisterProperty(o => o.Name);
public string Name
{
get { return GetProperty(NameProperty); }
set { SetProperty(NameProperty, value); }
}

rxelizondo replied on Monday, December 14, 2009

Sweeeeeeeeeeet!

Thanks rsbaker0 and Joe.

Wish Rocky would updated the forum to the latest community server version (I think is version 5). Maybe this issue are not existent in the newer version... but something tells me that it may be more trouble upgrading the forum that what its worth.

xAvailx replied on Monday, December 14, 2009

I know it probably will never happen...but I would LOVE if Rocky migrated this forum to something like Stack Exchange.

http://stackexchange.com/

Problem is it costs $$$

ajj3085 replied on Tuesday, December 15, 2009

I think there has been some success copying and pasted code into Word first, then copying and pasting into the text editor here.  Not sure why color doesn't work for me anymore tho Sad [:(]

namespace Csla

{

 

  /// <summary>

  /// This is the base class from which most business objects

  /// will be derived.

  /// </summary>

  /// <remarks>

  /// <para>

  /// This class is the core of the CSLA .NET framework. To create

  /// a business object, inherit from this class.

  /// </para><para>

  /// Please refer to 'Expert C# 2008 Business Objects' for

  /// full details on the use of this base class to create business

  /// objects.

  /// </para>

  /// </remarks>

  /// <typeparam name="T">Type of the business object being defined.</typeparam>

  [Serializable()]

  public abstract class BusinessBase<T> :

    Core.BusinessBase, Core.ISavable where T : BusinessBase<T>

  {

 

    #region Object ID Value

 

    /// <summary>

    /// Override this method to return a unique identifying

    /// value for this object.

    /// </summary>

    protected virtual object GetIdValue()

    {

      return null;

    }

 

    #endregion

 

    #region System.Object Overrides

 

    /// <summary>

    /// Returns a text representation of this object by

    /// returning the <see cref="GetIdValue"/> value

    /// in text form.

    /// </summary>

    public override string ToString()

    {

      object id = GetIdValue();

      if (id == null)

        return base.ToString();

      else

        return id.ToString();

    }

 

    #endregion

 }

CyclingFoodmanPA replied on Tuesday, December 15, 2009

I copy the code into Notepad and then the forum. Not fun, but it works really well...

JoeFallon1 replied on Tuesday, December 15, 2009

 xxx

RockfordLhotka replied on Tuesday, December 15, 2009

rxelizondo:
Sweeeeeeeeeeet! Thanks rsbaker0 and Joe. Wish Rocky would updated the forum to the latest community server version (I think is version 5). Maybe this issue are not existent in the newer version... but something tells me that it may be more trouble upgrading the forum that what its worth.

I have (or can get) a license for the current CS version. From what I understand, the upgrade takes a day or two - numerous SQL upgrade scripts, install/configure the new software and email gateway components and redo the UI style changes.

Fortunately my UI style changes are pretty minimal - mostly color changes.

I guess I have avoidance issues with this. I hate, hate, hate, hate fighting with email gateways and other network infrastructure stuff. So the idea of spending 1-2 days doing exactly that sort of thing is somewhere below the bottom of my list of things I want to do.  Much like deciding that for the next two days you'll hit yourself on the head with a hammer repeatedly. :)

Maybe it is because in a previous life (many many years ago) I managed a help desk and IT support group. What a horrible type of work - though it does give one great appreciation for the difference between supportable software and unsupportable software, and so I'm very grateful for the experience I gained in that job, as it made me a much better developer.

rxelizondo replied on Tuesday, December 15, 2009

I feel your pain Rocky, I would not want to touch that either.

I was thinking that since Community Server cost and arm and a leg, that they would have a nice update.exe that would do everything for you while you sit back and enjoy a cup of java.

Of course, I am sure this is probably not the case, chances are you won’t even have a chance to have your firs sip of java before you get the first (of many) error message!

rxelizondo replied on Wednesday, December 16, 2009

Actually, I changed my mind about this… not that it really matters what I think but :)

I think you should give updating the forum at least a shot. Primarily because hopefully, the new version of the forum may be more “code posting” user friendly. This is especially important now that the CSLA is starting to open up more and more to contributors. I can see contributors wanting to post code more often.

Just a suggestion of course. You know that this forum upgrade will need to happen sooner or later...

Hey, just get one of those interns to do the leg work, they always do what you tell them to do and never complain, specially if they are brand new :)

rxelizondo replied on Wednesday, December 16, 2009

OK, I think I finally got a solution:

1) Go to the forums preferences.
2) Once there select the “Site Options” tab.
3) On the “Content Editor” select “DefaultTextEditor” option from the dropdown.



Once you do that you can post all the HTML you want without having to worry about the editor trying to help you and end up screwing your post.

The only (but very annoying) problem is that what you post there is treated as pure HTML so you will need to escape and format everything to HTML.
For this I found this very handy site:


http://www.htmlescape.net/htmlescape_tool.html

Just drop your post, click on the “Escape” button and drop the escaped text in the CSLA forums.

Copyright (c) Marimer LLC