BlackBerry Forums Support Community
              

Reply
 
Thread Tools
Old 10-14-2004, 10:26 PM   #1
Mark Rejhon
Retired BBF Moderator
 
Mark Rejhon's Avatar
 
Join Date: Aug 2004
Location: Ottawa, Ontario, Canada
Model: Bold
Carrier: Rogers
Posts: 4,870
Default How to paste 100% FORMATTED Source Code In Your Forum Posts

Please Login to Remove!

How To Attach Source Code To Your Forum Posts

PHP Code:
Attaching source code is done by copy-and-paste.  Howeveryou need 
to 
do a special procedure.  When pasting source code in your posts in the 
Developer Forum
don't forget to put a "xxx91;codexxx93;" at the beginning of your 
source code, and then a "xxx91;/codexxx93;" at the end of your source code.   This 
prevents the forum system from messing up your source code. 

Example #1: Messy Paste

import javax.microedition.lcdui.*;

public class HelloWorld extends MIDlet implements CommandListener {
private Command exitCommand;
private TextBox tbox;

public HelloWorld() {
exitCommand = new Command("Exit", Command.EXIT, 1);
tbox = new TextBox("Hello world MIDlet", "Hello World!", 25, 0);
tbox.addCommand(exitCommand);
tbox.setCommandListener(this);
}

protected void startApp() {
Display.getDisplay(this).setCurrent(tbox);
}

protected void pauseApp() {}
protected void destroyApp(boolean bool) {}

public void commandAction(Command cmd, Displayable disp) {
if (cmd == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}



Example #2: Correctly Done Paste

PHP Code:
xxx91;codexxx93;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class 
HelloWorld extends MIDlet implements CommandListener {
    private 
Command exitCommand;
    private 
TextBox tbox;

    public 
HelloWorld() {
        
exitCommand = new Command("Exit"Command.EXIT, 1);
        
tbox = new TextBox("Hello world MIDlet""Hello World!"250);
        
tbox.addCommand(exitCommand);
        
tbox.setCommandListener(this);
    }

    protected 
void startApp() {
        
Display.getDisplay(this).setCurrent(tbox);
    }

    protected 
void pauseApp() {}
    protected 
void destroyApp(boolean bool) {}

    public 
void commandAction(Command cmdDisplayable disp) {
        if (
cmd == exitCommand) {
            
destroyApp(false);
            
notifyDestroyed();
        }
    }
}
xxx91;/
codexxx93; 
__________________
Thanks,
Mark Rejhon
Author of XMPP extension XEP-0301:
www.xmpp.org/extensions/xep-0301.html - specification
www.realjabber.org - open source

Last edited by Mark Rejhon; 03-15-2005 at 01:58 PM..
Offline   Reply With Quote
Old 09-30-2008, 03:32 AM   #2
myraddin
Knows Where the Search Button Is
 
Join Date: Sep 2008
Model: 8900
OS: 4.3-4.6.1
Carrier: t-mobile
Posts: 39
Wink

And how do we use colour in code ?
Can it be done automatically ?
Can we use [code=java] -> Edit: no we cannot

Edit:

I will answer myself :

use "[php]" instead of "[code]" -

(and no, "[java]" unfortunately does not work )

Last edited by myraddin; 10-02-2008 at 06:09 AM.. Reason: new found information
Offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Genuine Dell OEM G Series G7 7790 CPU and Graphics Heatsink Assembly XRF05 picture

Genuine Dell OEM G Series G7 7790 CPU and Graphics Heatsink Assembly XRF05

$20.30



OEM Dell latitude E7250 CPU Cooling Fan with Heatsink DP/N 04T1K3 0J3M4Y picture

OEM Dell latitude E7250 CPU Cooling Fan with Heatsink DP/N 04T1K3 0J3M4Y

$13.90



OEM Dell XPS 8910 8920 8930 Alienware Aurora R5 R6 R7 Front Cooling Fan 7M0F5 picture

OEM Dell XPS 8910 8920 8930 Alienware Aurora R5 R6 R7 Front Cooling Fan 7M0F5

$12.11



Genuine OEM Dell 2375 B2375dnf B2375dfw 110V Fuser fixing N41P2 sku 724-BBCI picture

Genuine OEM Dell 2375 B2375dnf B2375dfw 110V Fuser fixing N41P2 sku 724-BBCI

$94.99



OEM Dell XPS 8910 8920 8930 Alienware Aurora R5 R6 R7 Front Cooling Fan NF-A12 picture

OEM Dell XPS 8910 8920 8930 Alienware Aurora R5 R6 R7 Front Cooling Fan NF-A12

$30.60



1PCS NEW FIT FOR OEM Dell AC Adapter Dell Alienware DA330PM190 LA330PM190 330W picture

1PCS NEW FIT FOR OEM Dell AC Adapter Dell Alienware DA330PM190 LA330PM190 330W

$117.97







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.