Ingresar:

Rho :: Blog :: Posteando código fuente

January 20, 2007

user icon
Rho

Ahora ya es posible postear código fuente, bueno... siempre era posible, la diferencia que ahora realiza el coloreado de sintaxis.

Para utilizarlo tienen que usar las etiquetas [ code=LANG ] [ /code ]    (!sin espacios!)

Donde LANG puede ser los siguientes: cpp, java, php, html, css, py, js, sql.

Si no les sale coloreado, entonces les falta cargar el css, pueden  usar el tema por defecto o cargar las definicios de estilo a su css personalizado. 

Espero sus sugerencias! 

<? include 'header.php';   function index(){     echo "Weclcome to my php site!<br><a href="index.php?cmd=section2">Click  Here to go to the next section!</a>"; }   function section2(){     echo "Great!  You have made it to section 2.<br><a href="index.php">Go back to the index</a>";   }   switch($_REQUEST['cmd']){ //updated to work with register_globals "off";       default:     index();     break;         case "section2":     section2();     break; }   include 'footer.php'; ?>    

#!/usr/bin/env python   #.... '''Funcion principal.    dijkstra(filename) -> lista      devuelve las rutas (cortas) a    cada nodo a partir del origen    descritas en _filename_''' def dijkstra(filename='figure3.grf'):     ''' graph   dict con el grafo            S       lista de nodos procesados            d       dict con el costo de la ruta                     a cada nodo a partir del origen            pi      descripcion de las rutas a                     cada nodo         '''     global graph, S, d, pi       #cargamos el grafo con los datos del archivo     graph = dict(map(mkgraph, open(filename).readlines()))       #sacamos nodo origen     source = graph.pop('source')       from decimal import Inf         #todos los nodos con d[nodo] = Inf     #d = dict( [ [v,Inf] for v in graph.iterkeys() ] )     d = dict( map(lambda v: [v, Inf], graph.keys()) )         #todos los nodos con pi[nodo] = None     #pi = dict( [ [v, None] for v in graph.iterkeys() ] )     pi = dict( map(lambda v: [v, None], graph.keys()) )       #inicializamos el origen     d[source], pi[source] = 0, None       #lista de nodos procesados     S=[]       #Procesamos cada nodo restante en d-S     while len(listsub(d,S)) > 0:         #el nodo mas cercano que no haya sido procesado         node = minDist(dict(dlsub(d,S)))         S.append(node)                 #relajamos los adyacentes a nodo         doit(node)       #devolvemos las rutas en _pretty format_     return map(pretty, S)   if __name__ == '__main__':     import sys, posix     if len(sys.argv)==2 and posix.lstat(sys.argv[1]):         routes = dijkstra(sys.argv[1])     else:    routes = dijkstra()       #impresion de la salida segun Assignment 6, Handout #14         #Computer Science 51, Spring 2002     #FIXME: Same route output order as graph file     for route in routes:         node = route.split('->')[-1].split('(')[0]         line = node+': '           if '->' not in route: line += node+' is the source node'         else:    line += route                     print line   

Palabras clave: código fuente

Enviado por Rho



Comentarios

  1. // XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser // <a href="http://www.saxproject.org">http://www.saxproject.org</a> // Written by David Megginson // NO WARRANTY!  This class is in the public domain.   // $Id: XMLReaderAdapter.java,v 1.5.2.3 2002/01/29 21:34:15 dbrownell Exp $   package org.xml.sax.helpers;   import java.io.IOException; import java.util.Locale;   //...   /*  * @since SAX 2.0  * @author David Megginson  * @version 2.0.1 (sax2r2)  * @see org.xml.sax.Parser  * @see org.xml.sax.XMLReader  */ public class XMLReaderAdapter implements Parser, ContentHandler {     public XMLReaderAdapter ()       throws SAXException     {     setup(XMLReaderFactory.createXMLReader());     }       public XMLReaderAdapter (XMLReader xmlReader)     {     setup(xmlReader);     }       private void setup (XMLReader xmlReader)     {        if (xmlReader == null) {            throw new NullPointerException("XMLReader must not be null");         }        this.xmlReader = xmlReader;        qAtts = new AttributesAdapter();     }     //... }    

    user iconRho on Saturday, 20 January 2007, 16:36 BOT # |

  2. Por cierto, el plugin es "hecho en casa" Chulo

    user iconRho on Saturday, 20 January 2007, 16:47 BOT # |

  3. Interesante..

     

    sobre todo si es hecho en casa...

     

     

    user iconRamirex on Saturday, 03 February 2007, 12:17 BOT # |

  4. class HolaNena {     public static void main(String arg[])     {         System.out.println("Hola Nena, esto si funciona!!");       }  }   

    Rho, felicidades por el trabajo, si funciona!!

    user iconCristian Denis Mamani Torres on Saturday, 03 February 2007, 12:28 BOT # |

  5. [ code=cpp ]

    printf(%s,"Vaya.. me gusta esto"); 

    [ /code ]

    Invitado on Saturday, 15 September 2007, 02:22 BOT # |

  6.   printf(%s,"Vaya.. me gusta esto, ¿Asi?");     

    Invitado on Saturday, 15 September 2007, 02:23 BOT # |

  7. [ code=cpp ] #include using namespace std; int main(){ cout

    Maohs on Thursday, 18 October 2007, 17:10 BOT # |

  8. [ code=cpp ] [ /code ] int main(){ cout

    Invitado on Thursday, 18 October 2007, 17:13 BOT # |

  9.     //testing from TinyMCE visual editor     int *n = &amp;b[0];     for (i = 0; i &lt; 5; i++)       *n++ = i * 2;    

    user iconJohans Marvin Taboada Villca on Friday, 24 July 2009, 15:29 BOT # |

  10.   //testing from TinyMCE HTML Source Editor   int *n = &b[0];   for (i = 0; i < 5; i++)   *n++ = i * 2;    

    user iconJohans Marvin Taboada Villca on Friday, 24 July 2009, 15:30 BOT # |

  11.     //testing from TinyMCE visual editor     //using source code with 'LF' EOL     int *n = &amp;b[0];     for (i = 0; i &lt; 5; i++)       *n++ = i * 2;    

    user iconJohans Marvin Taboada Villca on Friday, 24 July 2009, 15:36 BOT # |

  12.   //testing from TinyMCE HTML Source Editor using   //manually inserted 'non-break-space-points'   int *n = &b[0];   for (i = 0; i < 5; i++)   *n++ = i * 2;    

    user iconJohans Marvin Taboada Villca on Friday, 24 July 2009, 15:50 BOT # |

  13.   /*    * @(#)Main.java 1.0, 07/24/09    *    * Copyright (c) 2009. Ajayu and friends. All rights reserved.    * Use is subject to license terms.    */   package net.jmt4b04d4v.ajayu;   import javax.swing.SwingUtilities;   import org.apache.log4j.Logger;   import net.jmt4b04d4v.ajayu.ui.swing.SwingGUI;    /**    * <p>    * <code>Main</code> is the Main class for Ayaju. Ayaju aims to be a pure Java    * implementation of Elgg, the current spirit of Ajayu.    * </p>    *    * @author jmt4b04d4v    * @version 1.0, 07/24/09    * @since Ayaju-1.0    */   public final class Main {       /** Logger for this class. */       private static Logger logger = Logger.getLogger(Main.class);       /**        * Main method.        *        * @param args        * Command line arguments.        */       public static void main(final String[] args) {           logger.trace("main(String[])");           final SwingGUI ui = SwingGUI.getInstance();           SwingUtilities.invokeLater(new Runnable() {               public void run() {                   logger.info("Starting Hello!");                   ui.setVisible(true);               }           });       }   }    

    user iconJohans Marvin Taboada Villca on Friday, 24 July 2009, 16:23 BOT # |

  14. Some comments:

    • Not completely sure why, but in my last five examples, I got something like "double EOL". Looking up in generated HTML source code, I've also noticed that my comments were rendered in a different way that previous comments, because they seem to have been stored in the DB in a different way. E.g. my comments use &#160; instead of &nbsp; and *really* have double EOL. Maybe a BUG in Chili? incompatibilities with TinyMCE ? We're currently using Chili 1.6 and 2.2 is already available. Also, we're currently using TinyMCE 2.9 and 3.2.5 is already available.
    • Also, whitespaces and non-break-space-points got trimmed when using TinyMCE HTML Source Editor.
    • Anyway, is usableLaughing, thanks.

    user iconJohans Marvin Taboada Villca on Friday, 24 July 2009, 17:11 BOT # |

Debes iniciar sesión para enviar un comentario.