code-snippets

In SOLR, how can I get the position of highlighted snippets within associated field?

I want to display my search results in a google-like way: <title> ...<snippet>...<snippet>...<snippet>... <link> I'm concatenating the highlighted snippets, but I need to know when the snippets are at the beginning of the end of the content field (do decide whether to put the starting/ending "..."'s in) Does anyone know how I can get...

Sphinx, reStructuredText show\hide code snippets

Hi, I've been documenting a software package using Sphinx and reStructuredText. Within my documents, there are some long code snippets. I want to be able to have them hidden as default, with a little "Show\Hide" button that would expand them (Example). Is there a standard way to do that? If not, I think I will suggest this feature to...

Is there a size limit on code snippets in Visual Studio 2008?

I created a long code snippet with Snippet Editor. After saving I can see and use it within Visual Studio, however, the code is suddenly trunctated after about 120 lines and there appears some garbled text at the end. Is there a size limit to code snippets? If yes, is this a visual studio, or a Snippet Editor "feature"? ...

Anyone know of a Snippet or File Repository Application in PHP?

I am looking to start a community based on user posted scripts such as bashrc, screenrc, aliases, etc. Does anyone know of a web application in PHP that would do that? I am not looking for a snippet program, or a link directory. Users can store linux/UNIX/Windows configuration files, as well as maybe an option to attach a screenshot....

storing code snippets in a database

Hey everyone, I want to make a code snippet database web application. Would the best way to store it in the database be to html encode everything to prevent XSS when displaying the snippets on the web page? Thanks for the help! ...

Eclipse Code Templates with Cobol

People, My team is just beginning to learn how to use COBOL on Eclipse (as part of the Rational Developer for System Z package) and one of our most desired features are code templates or code snippets. What we'd like to have is a code completion based on snippets just like we have on Java. For example, when I type try and hit ctrl-spa...

Is there a way to use pre-existing JSP Tag libraries within the Lift framework (e.g. via snippets)?

Hi, I'm fairly new to Lift/Scala but like the ideas of less code writing and function passing etc. I've had a brief look at the Lift web framework but was wondering if it is at all possible to leverage pre-existing JSP Tag libraries, ideally while being able to still place/mix with Lift's snippet tags? As Scala is able to utilise norm...

Does every PHP code snippet inside the <?php> tag have its own variable scope?

If yes is there any way to access a var defined in another PHP code snippet tag? ...

Where can I get VS code snippets?

Apparently there are many questions that deal with how to store code snippets for Visual Studio, but I did not find one that contains links. So, is there a website that offers useful snippets? My google-fu only brought up many false positives or broken sites. ...

Eclipse Code Templates: insert clipboard?

I have begun using Eclipse code templates and am loving 'em! But for existing code they are a bit hard to use. This is easiest with an example. I have a pre-existing bit of code and I want to wrap it in a try-catch block. Currently I create the try-catch block from the template and then cut-paste the code I want inside the try block. W...

snippet generation in php

Hi, I have a long chunk of text that came back from a search query. I'd like to display a snippet of the text, not the entire thing, and highlight the search query within the snippet. I realize that decided what part of the text to slice can be complicated, and I was hoping for any ideas on how do to this? Thanks! ...

Coda Snippet Sync

Hi all, I've been trying to rack my head around making a coda plugin for syncing coda's clips to snipplr.com, coda is such a great app, but the inability to sync my hand crafted snippets is really irritating especially when you are out and about with a laptop! I was wondering if anyone has any experience in developing such a plugin, o...

Looking for a Java equivalent to .NET's Snippet Compiler

I am looking for a Java equivalent to .NET's Snippet Compiler. Is there any such utility out there? That or a really light weight Java IDE for Windows? Eclipse and NetBeans seem too heavy-weight to practice basic syntax. ...

MODX: Snippet strips and hangs string when parsing the vars.

Hey all i have a snippet call like this: [!mysnippet?&content=`[*content*]` !] What happen is that, if i send some html like this: [!mysnippet?&content=`<p color='red'>Yeah</p>` !] it will return this: <p colo the [test only] snippet code (mysnippet) is: <?php return $content; ?> Why is this happening? My actual snippet is c...

What are the plugins to insert code snippets in website?

It wld be best if the plugins have syntax highlighting function for html,css and javascript ...

Can I use one of the programming licenses on parts of the code?

I wish to give different licenses to different parts of my code. Also I need to put some copy rights on several SQL statements. Is it possible? How should I organize my code to make it happen? ...

Inserting snippets from macros

In Visual Studio 2008 I had a macro which would insert a snippet and input today's date in one of the replacements. When I try to run this macro in VS 2010 it doesn't work. No matter how I try it will not insert a snippet. When I try the following command: DTE.ExecuteCommand("Edit.InvokeSnippetFromShortcut", "snippetName") This ...

What is a good program for storing “chunks” of commonly used source code

I've looked at CodeLocker (poorly styled and relatively unflexible, but free) and Source Code Library (Overzone software - very nicely styled, looks flexible, but very expensive - $80). Ideally, I'm looking for a relatively simple, inexpensive program (not an online website) that I can save text data (source code) with a title and keywo...

Help me understand the code snippet in c#

I am reading this blog: Pipes and filters pattern I am confused by this code snippet: public class Pipeline<T> { private readonly List<IOperation<T>> operations = new List<IOperation<T>>(); public Pipeline<T> Register(IOperation<T> operation) { operations.Add(operation); return this; } public void ...

Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in ...

Hi, I'm working with PHP PDO and I have the following problem: Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /var/www/site/classes/enterprise.php on line 63 Here is my code: public function getCompaniesByCity(City $city, $options = null) {...