Go Back   AnandTech Forums > Software > Programming

Notices

Forums
· Hardware and Technology
· CPUs and Overclocking
· Motherboards
· Video Cards and Graphics
· Memory and Storage
· Power Supplies
· Cases & Cooling
· SFF, Notebooks, Pre-Built/Barebones PCs
· Networking
· Peripherals
· General Hardware
· Highly Technical
· Computer Help
· Consumer Electronics
· Digital and Video Cameras
· Gadgets Gear and Phones
· Audio/Video & Home Theater
· Software
· Software for Windows
· All Things Apple
· *nix Software
· Operating Systems
· Programming
· PC Gaming
· Console Gaming
· Distributed Computing
· Security
· Social
· Off Topic
· Politics and News
· The Garage
· Health and Fitness
· Merchandise and Shopping
· For Sale/Trade
· Hot Deals
· Free Stuff
· Contests and Sweepstakes
· Forum Issues
· Technical Forum Issues
· Personal Forum Issues
· Suggestion Box
   

Reply
 
Thread Tools
Old 11-02-2009, 02:13 PM   #1
Cogman
Diamond Member
 
Cogman's Avatar
 
Join Date: Sep 2000
Posts: 4,341
Default All hail working code blocks!!!

Perhaps the feature I've been drooling over the most. Working code blocks!!. Post your code here in memory of fusetalks broken code blocks

Code:
#include <iostream>
using namespace std;

int main()
{
    cout << "Hello vb Forums\nGoodbye crappy fusetalk code enclosures!\n";
}
Cogman is offline   Reply With Quote
Old 11-02-2009, 02:14 PM   #2
Cogman
Diamond Member
 
Cogman's Avatar
 
Join Date: Sep 2000
Posts: 4,341
Default

NM. Turns out there was just an exceptionally long delay before the thread appeared.

Last edited by Cogman; 11-02-2009 at 02:39 PM.
Cogman is offline   Reply With Quote
Old 11-02-2009, 04:14 PM   #3
Gamingphreek
Lifer
 
Gamingphreek's Avatar
 
Join Date: Mar 2003
Location: Blacksburg, VA
Posts: 11,019
Default

Oh my goodness. Working code blocks is like Christmas come early. Now just to find a reason to post some code...
__________________
And 'lo, I am with you always, even to the end of the age. -Matthew 28:20

Proud to be a Hokie :: neVer forgeT 4/16/06

Heatware
My Rig
Gamingphreek is offline   Reply With Quote
Old 11-02-2009, 04:37 PM   #4
dighn
Lifer
 
dighn's Avatar
 
Join Date: Aug 2001
Location: The Best Place on Earth
Posts: 20,015
Default

Code:
for(int i = 0; i < 10; ++i)
    array[i][b] = 10;

<stars attr="test">
    <star>sol</star>
</stars>

a
 a
  a
   a
    a
   a
  a
 a
a
yay
dighn is offline   Reply With Quote
Old 11-02-2009, 04:55 PM   #5
Crusty
Diamond Member
 
Crusty's Avatar
 
Join Date: Sep 2001
Location: ATX
Posts: 9,392
Default

It would be nice if there line numbers that were shown on the display but not stored with the code entry. That would keep it easy to edit and quote the code while still providing for line numbers for reference in the posts.

That would probably be easy to do using a greasemonkey script....

Code:
module AT
where

odd n =
    if (n == 0) then
    False
    else
    AT.even (n-1)
even n =
    if (n == 0) then
    True
    else
    AT.odd (n-1)
__________________
CHRANCHALA!
Crusty is offline   Reply With Quote
Old 11-02-2009, 05:26 PM   #6
RedSquirrel
Diamond Member
 
RedSquirrel's Avatar
 
Join Date: May 2003
Location: ON, Canada
Posts: 7,765
Default

Wow I forgot about that. This is definably a good thing. Bolding only goes so far to post code.


*random code from first thing that happens to be already open*
Code:
		//--- SQL stuff
		private SQLsaveState m_SaveState=SQLsaveState.Unset;
		
		[CommandProperty( AccessLevel.GameMaster )]
		public SQLsaveState SaveState
		{
			get { return m_SaveState; }
			set {				
				System.Debugger.Write("itemsavestate_called","{0} changed from ({1} to {2})",this,m_SaveState,value);
			
				if(value!=m_SaveState)
				{
					System.Debugger.Write("itemsavestate_called","{0} changed from ({1} to {2}) - check1 passed",this,m_SaveState,value);
					if(value!=SQLsaveState.Unchanged)
					{
						System.Debugger.Write("itemsavestate_called","{0} changed from ({1} to {2}) - check2 passed",this,m_SaveState,value);
						Item tmp=null;
						bool doadd=true;
						if(World.ChangedItems.TryGetValue(this.Serial,out tmp))
						{
							if(tmp==this)doadd=false;
						}
						
						if(doadd)
						{
							System.Debugger.Write("itemsavestate_called","{0} changed from ({1} to {2}) - check3 passed",this,m_SaveState,value);
							lock(World.ChangedItems)
							{
								System.Debugger.Write("itemsavestate","Adding {0} to changed list ({1} to {2})",this,m_SaveState,value);
								World.ChangedItems[this.Serial] = this;	
							}
						}				
					}
				
					m_SaveState=value; 
				}
			}
		}
		
		
		
		//call this whenever the object gets modified so we can properly set the sql save state
		public void Modify()
		{			
			System.Debugger.Write("modifyitem_called",false,"{0} Modified (Item)",this);
			if(!World.Loaded)return; //don't do anything at world load or everything ends up getting changed
			if(!World.StopSaving && (SaveState==SQLsaveState.Unchanged))
			{
				SaveState=SQLsaveState.Changed;
				System.Debugger.Write("modifyitem",false,"{0} Modified (Item)",this);
			}
		}
				
		
		//--- end SQL stuff
Yay!
__________________
~Red Squirrel~
Age of Valor: UO Free shard :: My blog
RedSquirrel is offline   Reply With Quote
Old 11-02-2009, 07:00 PM   #7
Markbnj
Moderator
 
Join Date: Sep 2005
Posts: 5,159
Default

I think you guys may be overreacting. I mean, what's it been? Three, maybe four years...

Code:
 
#define P(X)j=write(1,X,1)
#define C 39
int M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-1,C},*b=N,
*d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0;
s<4;s++)if((k=m[s]+g)>=0&&k<C*R&&l[s]!=k%C&&(!M[k]||!j&&c>=16!=M[k]>=16))a[f++
]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=j<f?f:j;f+=c&-16*!j;M[g]=
c|1<<s;M[*d++=e]=f|1<<(s+2)%4;}else e=d>b++?b[-1]:e;}P(" ");for(s=C;--s;P("_")
)P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2))P("| "+(*u/4)%2
);}
__________________
Everytime I try to tell you, the words just come out wrong

**
Some meaningless scribbling of no account

Arts and Letters Daily - Get some culture

Last edited by Markbnj; 11-02-2009 at 07:03 PM.
Markbnj is offline   Reply With Quote
Old 11-02-2009, 08:05 PM   #8
Cogman
Diamond Member
 
Cogman's Avatar
 
Join Date: Sep 2000
Posts: 4,341
Default

Quote:
Originally Posted by Markbnj View Post
I think you guys may be overreacting. I mean, what's it been? Three, maybe four years...

Code:
 
#define P(X)j=write(1,X,1)
#define C 39
int M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-1,C},*b=N,
*d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0;
s<4;s++)if((k=m[s]+g)>=0&&k<C*R&&l[s]!=k%C&&(!M[k]||!j&&c>=16!=M[k]>=16))a[f++
]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=j<f?f:j;f+=c&-16*!j;M[g]=
c|1<<s;M[*d++=e]=f|1<<(s+2)%4;}else e=d>b++?b[-1]:e;}P(" ");for(s=C;--s;P("_")
)P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2))P("| "+(*u/4)%2
);}
Nooo, Fusetalk is back! Quick, Kill it before it takes over again
Cogman is offline   Reply With Quote
Old 11-02-2009, 08:12 PM   #9
Markbnj
Moderator
 
Join Date: Sep 2005
Posts: 5,159
Default

Haha, fear not. Here is the line of text that originally appeared above that code block:

The following program, by Carl Shapiro, won the Grand Prize for most well-rounded in confusion of the 1985 International Obfuscated C Code Contest
__________________
Everytime I try to tell you, the words just come out wrong

**
Some meaningless scribbling of no account

Arts and Letters Daily - Get some culture
Markbnj is offline   Reply With Quote
Old 11-02-2009, 09:01 PM   #10
GodlessAstronomer
Diamond Member
 
GodlessAstronomer's Avatar
 
Join Date: Oct 2007
Location: Tauranga, New Zealand
Posts: 9,025
Default

Wonderful Now we just need code coloring
__________________
flickr | Using the Google Reader API: Part 1 | Part 2

Sift the Twos and sift the Threes,
The Sieve of Eratosthenes.
When the multiples sublime,
The numbers that remain are Prime.
GodlessAstronomer is offline   Reply With Quote
Old 11-03-2009, 02:29 AM   #11
Colt45
Lifer
 
Colt45's Avatar
 
Join Date: Apr 2001
Location: Российская СФСР
Posts: 16,964
Default

Code:
/*

            ░████░    ░████░
            ██████    ██████     ██
           ▒██  ██▒  ▒██  ██▒    ██
██      ██ ██▒  ▒██  ██▒  ▒██  ███████
██░    ░██ ██    ██  ██    ██  ███████
▓█▒ ██ ▒█▓ ██ ██ ██  ██ ██ ██    ██
▒█▒░██░▒█▒ ██ ██ ██  ██ ██ ██    ██
 █▓▒██▒██  ██    ██  ██    ██    ██
 ██▓██▓██  ██▒  ▒██  ██▒  ▒██    ██
 ███▒▒██▓  ▒██  ██▒  ▒██  ██▒    ██░
 ▒██░░██▒   ██████    ██████     █████
 ░██  ██    ░████░    ░████░     ░████

*/
__________________
.. . H . H
. . . | . |
H--C--C--O--H. . . . . . PDP-11 @ 763kHz
. . . | . |. . . . . . . . . . . . . . radioteletype at 45.45baud
.. . H . H
Colt45 is offline   Reply With Quote
Old 11-03-2009, 10:29 AM   #12
Cogman
Diamond Member
 
Cogman's Avatar
 
Join Date: Sep 2000
Posts: 4,341
Default

Quote:
Originally Posted by GodlessAstronomer View Post
Wonderful Now we just need code coloring
Code:
#include <iostream>
int main()
{
   std::cout << "Like This?\n";
}
Cogman is offline   Reply With Quote
Old 11-03-2009, 10:45 AM   #13
Crusty
Diamond Member
 
Crusty's Avatar
 
Join Date: Sep 2001
Location: ATX
Posts: 9,392
Default

Quote:
Originally Posted by Cogman View Post
Code:
#include <iostream>
int main()
{
   std::cout << "Like This?\n";
}
Yeah... but who wants to do that manually
__________________
CHRANCHALA!
Crusty is offline   Reply With Quote
Old 11-03-2009, 11:05 AM   #14
RedSquirrel
Diamond Member
 
RedSquirrel's Avatar
 
Join Date: May 2003
Location: ON, Canada
Posts: 7,765
Default

Hmm I was pretty sure vb had code coloring in by default. Suppose that could be coded in, but it's not easy. TONS of regex, but doable.
__________________
~Red Squirrel~
Age of Valor: UO Free shard :: My blog
RedSquirrel is offline   Reply With Quote
Old 11-03-2009, 04:35 PM   #15
ivan2
Diamond Member
 
ivan2's Avatar
 
Join Date: Mar 2000
Location: New York
Posts: 4,156
Default

i was gonna find a nice pedobear ascii art but couldn't..
ivan2 is offline   Reply With Quote
Old 11-03-2009, 09:47 PM   #16
chronodekar
Senior Member
 
chronodekar's Avatar
 
Join Date: Nov 2008
Posts: 596
Default

Finally !!!!

__________________
The Official Free References Thread

When faced with an opponent that you cannot defeat, visualize something that will allow you to defeat him!
chronodekar is 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


All times are GMT -5. The time now is 11:50 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.