Results 1 to 21 of 21

Thread: Code "Snippet" Database

  1. #1

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Code "Snippet" Database

    I am looking for a piece of software that I can use to manage all of the snippets of code that I use. Now I am not talking about snippets from a .Net IDE perspective that plug into the IDE, rather I am talking about small chunks of code anywhere from 5-25 lines that demonstrate functionality. I am looking for a program that supports multiple languages (VB6, VB.Net, C#, VBScript, Javascript) and I would hope it has a built in search functionality.

    Anyone use a program like this that they would recommend?

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Code "Snippet" Database

    For VB 6.0 Koolsid created:
    http://www.vbforums.com/showthread.p...89#post3454189

    Maybe he can adapt it for other languages as well!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Code "Snippet" Database

    Or you could just make one and share it with here. =)
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Code "Snippet" Database

    Quote Originally Posted by dee-u
    Or you could just make one and share it with here. =)
    I was thinking about that, if I didn't get any responses that I liked.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Code "Snippet" Database

    I would also suggest making your own. You can tailor it for your individual needs and tastes.

    I first built my Code Library in 1993 with VB3 and an Access 2.0 database, and it has gone through each interation of VB and Access since then.

    At the moment, I have 9 Code categories and a total of 1,472 code snippets/routines/tips that I've gathered over the years. This can be real handy when doing contract work at different companies.

    One thing I would strongly stress is to write yourself a good search function. What I initially did was fine because I hardly had anything in it. As time went on, however, and I started saving more and more routines in different categories, actually finding what I wanted because a pain.

    The .NET version is about 1/4 done... - I work on it when the spirit moves me.
    Last edited by Hack; Feb 27th, 2009 at 07:47 AM.

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Code "Snippet" Database

    Hey,

    This is something that I would be very interested in as well. If there is anything that I can do to help I would be more than willing. Is this something that could make it onto a CodePlex project for collaboration purposes?

    Thanks

    Gary

  7. #7

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Code "Snippet" Database

    OK, well maybe I will start on something rudimentary this weekend and if it looks promising, I will do a codeplex site.

  8. #8
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Code "Snippet" Database

    I always planned on doing one of these using Web Services and then making applications across multiple platforms (Windows, Linux, OS X, WM, BlackBerry, etc) and have it sync up.

    My ideas are always so grand but I never have any god damn time
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  9. #9
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Code "Snippet" Database

    Quote Originally Posted by Negative0
    OK, well maybe I will start on something rudimentary this weekend and if it looks promising, I will do a codeplex site.
    Hey,

    Let me know how you get on with this, as I would be willing to help out. I have got some study to do this weekend, got a Microsoft Certification exam next week, but I am sure I could convince myself that helping out would actually be a form of studying

    Gary

  10. #10
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Code "Snippet" Database

    If any one can give me the .Net Strings which should of color blue then maybe I adapt the code generator to work for .Net as well... For xample I am using this for VB6

    "Or|Do|And|Random|Append|Binary|Exit|Then|GoTo|Case|Select|End|ReDim|" _
    & "For|Each|Loop|While|Until|Next|True|False|Sub|Function|As|Private|Dim|Open|Access|" _
    & "Else|ElseIf|Public|Close|Open|If|ByVal|(ByVal|Set|Nothing|Option|Explicit|Declare|" _
    & "Long|Long,|Long)|Lib|LBound|UBound|With|Call|Integer|Integer,|Integer)|Read|Lock|" _
    & "Byte|Byte)|Byte,|Double|Double)|Double,|Boolean|Boolean)|Boolean,|Any|Any,|Any)|" _
    & "Currency|Currency,|Currency)|Date|Date,|Date)|New|New,|New)|Object|Object,|Object)|" _
    & "Single|Single,|Single)|String|String,|String)|Variant|Variant,|Variant)|Alias|Const|" _
    & "Public|Not|Enum|Static|Friend|ByRef|(ByRef|ParamArray|Type|WithEvents|Resume|Is|Set|" _
    & "Debug.Assert|Debug.Print|False:|Else:|Global|EndIf"
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  11. #11

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Code "Snippet" Database

    I appreciate your offer sid, but I am looking for something that is a stand alone app that I can use for a multitude of languages.

    Based on the responses, I started going down the path of mocking something up. I am thinking that the treeview will driven by the user, they can add groups and sub groups and code as they see fit. The right hand side will be driven by the data.

    So there will be a tab for every language that the code is implemented in. So you could have one chunk of code for saving to a text file and have VB.Net, C#, and vbscript implementations of that code. Let me know what you guys think.
    Attached Images Attached Images  

  12. #12
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Code "Snippet" Database

    Hey,

    I think it looks really promising!!

    I was giving this some thought over the weekend, and I really like the idea of implementing the database as a webservice. That way if you are away from your desk you can maybe use a web front end for looking at the data.

    Have you given much thought to the search functionality?

    I have got a couple ideas about populating the different languages. Let's say you copy and paste some simple VB code into the application, it could automatically call a conversion web service to convert the code to C# and vice versa. Obviously you may need to be able to edit it incase it is wrong.

    Syntax highlighting would be a nice feature as well.

    This could go off in lots of different directions, but I definitely think it has potential.

    Let me know if you want some help developing this!!

    Gary

  13. #13
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Code "Snippet" Database

    Quote Originally Posted by Negative0
    Based on the responses, I started going down the path of mocking something up. I am thinking that the treeview will driven by the user, they can add groups and sub groups and code as they see fit. The right hand side will be driven by the data.
    Too hard to navigate when you have 1,400+ snippets like Hack.

    First off what if I want to add C++ code? So you add a tab for that... then what happens if I want to add LISP? MASM? etc.

    I'd think a tagging system would work better than a treeview. For each piece of code you could apply multiple tags and specify any language. Then, when you need to find something you would select from alphabetized tags on the left (similar to how Evernote works) and many languages spread out across the top or in a menu.

    I'd love to mock something up but I don't have time. Treeviews are heavily overdone for this kind of thing and I don't think that's very usable.
    Quote Originally Posted by gep13
    I was giving this some thought over the weekend, and I really like the idea of implementing the database as a webservice. That way if you are away from your desk you can maybe use a web front end for looking at the data.
    Well at least someone likes my grand ideas .
    Quote Originally Posted by gep13
    Have you given much thought to the search functionality?
    I haven't given much thought to anything other than a really high level look as to how it would work.

    I would imagine we'd just implement a set of APIs for the web services that include searching for terms unless it's a desktop application (in which case we'd just download everything and sync with the database with necessary).
    Quote Originally Posted by gep13
    I have got a couple ideas about populating the different languages. Let's say you copy and paste some simple VB code into the application, it could automatically call a conversion web service to convert the code to C# and vice versa. Obviously you may need to be able to edit it incase it is wrong.
    I don't think we'd need a web service for this and I'd see this as more of a "2.0" feature but we could build a module that could convert code and just call it locally. Web services should really only be used for sending and receiving data.
    Quote Originally Posted by gep13
    Syntax highlighting would be a nice feature as well.
    Syntax highlighting is a definite need. It needs to be a flexible and extensible system, however. This way you could, out of the box, have profiles for C#, VB.Net, etc but others could add C++, LISP, etc.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  14. #14

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Code "Snippet" Database

    I am not opposed to the web service idea, but that would probably be an easy thing that would be totally separate of the main application. One of my requirements is having it portable, so it could be used from a thumb drive if necessary (provided the machine trusted the thumb drive and it had the right version of the FW).

    I like the conversion of vb.net to C# and vice versa.

    Syntax highlighting would be nice, but I think that is an easy piece that can be bolted on at any time. I was thinking of even making this a plugin, so if someone wanted to write a highlighter for another language, it would be easy.

    All good ideas.

    I have never created a codeplex site before, but I'm willing to give it a shot. Plus it will be a good learning experience for me .

  15. #15
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Code "Snippet" Database

    Hey,

    From my experience, never created a CodePlex site but have contributed, it is fairly easy to do. So yeah, why not, give it a shot.

    If you have any specific areas that you are wanting worked on then feel free to get in touch.

    Gary

  16. #16
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Code "Snippet" Database

    Here is my idea proposal:
    Attached Images Attached Images  
    My usual boring signature: Something

  17. #17

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Code "Snippet" Database

    I like Kasracer's suggestion about an interface like Evernote. I think it makes sense for an app like this. And I agree totally on the any language thing. That is a big requirement for me, because I want to be able to store anything in here. I already know I want to store snippets from the following languages: C#, VB (6, .Net, and script), Javascript, HTML, SQL, Assembly, Java.

    I might take this as an opportunity to really dig into WPF as well, because I really like how easy it is to customize the listbox control and I think that will help in the search results.

  18. #18
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Code "Snippet" Database

    Perhaps an idea or two can also be derived from this sample?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  19. #19
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Code "Snippet" Database

    Hey,

    What is the latest with this? Any more thoughts?

    Gary

  20. #20

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Code "Snippet" Database

    I've gone back and forth on this from a windows app to a WPF app to a totally hosted website. I haven't had much time to dedicate to it.

    Some of the evernote ideas have made me think that I might just be able to use Evernote to store the data and live without the color coding of the text.

  21. #21
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Code "Snippet" Database

    I still like the idea of creating something from scratch, more of a learning curve than anything, but it's the same old thing about getting the time to do it.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width