The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Ehtyar on January 18, 2007, 10:05:53 AM

Title: A place to store my snippets?
Post by: Ehtyar on January 18, 2007, 10:05:53 AM
Hi all.
I've been at it with MASM for some time now, and thanks mostly to this forum, i have quite a lot of handy snippets floating around. Trouble is I tend to stick them in inappropriately named  text files that i will never find again at the right time. My question is does anyone have the name of a program i can use to store them. My requirements are that it is accessible offline, and does not make use of .NET. Naturally i am willing to spend some money if the program is good and reasonably priced. Any reply is helpful.

Thanks, Ehtyar.
Title: Re: A place to store my snippets?
Post by: TNick on January 18, 2007, 11:16:43 AM
Hello, Ehtya!
What about building such a program? I was just thinking about such app to store the code, times obtained on warious machines (if appropriate) and a brief description. A search engine would be very helpfull and, maybe a treeview to categorise the snippets I think it would be quite simple, no more than a day or two.
What do you say?
Nick
Title: Re: A place to store my snippets?
Post by: jack on January 18, 2007, 01:23:28 PM
do a Google search for:
snippet organize
Title: Re: A place to store my snippets?
Post by: Ehtyar on January 18, 2007, 08:48:44 PM
Quote from: jack on January 18, 2007, 01:23:28 PM
do a Google search for:
snippet organize
Thank you Jack. The purpose of my question was to determine if any of these were decent programs. Though i had only found two organizers with websites that are online, both of which use .NET.  :snooty:

Quote from: TNick on January 18, 2007, 11:16:43 AM
Hello, Ehtya!
What about building such a program? I was just thinking about such app to store the code, times obtained on warious machines (if appropriate) and a brief description. A search engine would be very helpfull and, maybe a treeview to categorise the snippets I think it would be quite simple, no more than a day or two.
What do you say?
Nick
Nick, before making this post, i did a little research on building my own as well. The part where i got stuck was designing a workable database format. INI will not cut it i think, sqlite has awful documentation, and i cannot find another winapi database format available as a static lib or dll.  :'(
However, if you have some ideas, and would like to discuss collaboration on such a project, i would be more than happy to supply you with my MSN details, IRC details, or simply an email address. Also please feel free to PM me at any time, thought i must warn you, this will be my first project involving a database of this kind, and i have never implemented treeview or search functionality in any of my previous projects, so i will be spending a lot of time learning.

Please keep the replies coming everyone if you have suggestion, if nothing else it might give Nick and I some ideas on how to build our own snippet storage program.  :dance:

Thanks, Ehtyar.
Title: Re: A place to store my snippets?
Post by: Ehtyar on January 19, 2007, 04:07:46 AM
Was sitting at work today bored out of my mind and it suddenly hit me....XML. I'm going to do some research on it now, not sure what i'll find, but i also have a dialog design in mind from your suggestions TNick, though if we build this thing, i think search will have to be your department :P
Anyway, going to do some research, might build a non-working example dialog too if i have time.

Ehtyar.
Title: Re: A place to store my snippets?
Post by: TNick on January 19, 2007, 01:30:02 PM
Hey, glad to see that you like the idea. Now, about that database, I know that general opinion is you should stay with the existing databases. But ... I was kind of thinking that it shouldn't be that hard. Let me think for an hour and I will post a simple format for this ...

And about that treeview, I am working on a custom one - open source - but I'm stuck with some problems. If I can finish it in some resonable time, we could use this one.

A dialog example would be great, BTW.

Nick
Title: Re: A place to store my snippets?
Post by: P1 on January 19, 2007, 03:48:43 PM
Did you know that ...

Part of how the C language came about was that, it was a shell of Assembler routines.  AKA, a Snippet Librarain of sorts.

As always, as programmers in the greatest of all languages, it's either roll your own, or smoke someone's elses.

Regards,  P1  :8)
Title: Re: A place to store my snippets?
Post by: TNick on January 19, 2007, 04:04:56 PM
 :eek
Title: Re: A place to store my snippets?
Post by: daydreamer on January 19, 2007, 05:40:52 PM
Quote from: P1 on January 19, 2007, 03:48:43 PM
Did you know that ...

Part of how the C language came about was that, it was a shell of Assembler routines.  AKA, a Snippet Librarain of sorts.

As always, as programmers in the greatest of all languages, it's either roll your own, or smoke someone's elses.

Regards,  P1  :8)
smoke someone's else that is made in Highlevel, no please I don't want to get High
Title: Re: A place to store my snippets?
Post by: TNick on January 19, 2007, 06:58:37 PM
Well, it was more than an hour, but here is some sample. I will try to add some controls, but there are some basic things for our database: add, remove, read. To be done: edit and search.

Nick
PS. I didn't test the code yet,and some optimization is required.


[attachment deleted by admin]
Title: Re: A place to store my snippets?
Post by: Ehtyar on January 19, 2007, 08:02:50 PM
Hi again TNick.
I'm not even going to pretend i know how all this works at this point, though i have to say without radasm, radasm produced code is extremely hard to follow. I am, however, very glad you have developed your own database format, as parsing xml was easy, but rewriting it was nigh on impossible without some third party addon. The format i had in mind was something like this:

<Database cdate="190107">
<Category name="cat1">
<Snippet name="snip1" date="190107">
blablabla
this is a snippet
blablabla
</Snippet>
</Category>
</Database>

but anyway, on to other things...
The dialog im thinking of (ugly demo) is here:
(http://repetitious.digitalshell.net/~Ehtyar/DemoDlg.png)
I know it's extremely ugly, but there we go for the moment. Was thinking it would be good idea to use HiEdit for displaying the snippet. We will have line numbers and undo built in, and writing the snippet to file will be a piece of cake. If you're interested ill start working on the dialog right away.

Thanks, Ehtyar.
Title: Re: A place to store my snippets?
Post by: TNick on January 19, 2007, 08:22:48 PM
Absolutely interested! :)
HiEdit is a good idea, and the dialog is looking good, already!

Let's proceed, then!

Nick
Title: Re: A place to store my snippets?
Post by: hutch-- on January 20, 2007, 02:34:36 PM
Ehtyar,

If you are going to have a tree structure why not use the file system as it already has that logic and is close enough to infinitely extendable. It also has the advantage that you can add to it and modify things with other tools like a normal text editor. The accessory I have in masm32 "Procedure Browser" uses this basic system and all I need to do to add to it is save a section of a file that I want as a snippet into one of the directories where I have it pointed and I can routinely scan through mountains of source code to find bits and pieces.

Even if you wanted to share it around, you need do no more than put an app something like this at the head of a directory structure and zip the directory and all of its subdirectories and you have it as a single working file that can be passed around.
Title: Re: A place to store my snippets?
Post by: ramguru on January 20, 2007, 06:27:30 PM
I once had an idea to make a program with 500 templates of about dialog. I were thinking to use sqlite...To say truth I've never gave up that idea  :lol
So now when I think about this: I even can embed chosen template directly to exe file (no problem) if DB stores data in res format. Damn this is a great idea for my current project RP  :bg
Title: Re: A place to store my snippets?
Post by: u on January 20, 2007, 09:27:21 PM
Just wanted to finally play with listboxes to learn them...

[attachment deleted by admin]
Title: Re: A place to store my snippets?
Post by: Ehtyar on January 20, 2007, 10:32:39 PM
Hutch, That is indeed an interesting idea, quite practical also. However, TNick has already developed a database frontend for our project, so maybe next time, but thank you :)
ramguru, Have you looked at the sqlite api/docs lately? ;)
Ultrano, thank you for the example, I'm sure TNick will have a look at it and see if he can get any hints. I was also thinking of using your awesome PrefState.lib if we have a lot of preferences to save later on. (if we use any of your work in this project you will be mentioned in the about box)
TNick and i will be communicating via MSN for this project, and we will try to post updates here as we make progress.
Currently i am (trying to) adding HiEdit into the dialog, and clean it up a little. It has not gone smoothly thus far, but akyprian is helping me out on the winasm forum TNick has already developed a basic interface for the database, which will be tested as soon as i get HiEdit up and running. Cross your fingers ;)

Ehtyar.
Title: Re: A place to store my snippets?
Post by: ramguru on January 20, 2007, 10:39:35 PM
Quote from: Ehtyar on January 20, 2007, 10:32:39 PM
ramguru, Have you looked at the sqlite api/docs lately? ;)

Not really lately (http://www.masm32.com/board/index.php?topic=1891.msg19952#msg19952) but remember everything as this was two hours ago  :bg
My snippets will definitely be of blob type :)
Title: Re: A place to store my snippets?
Post by: Ehtyar on January 21, 2007, 09:14:24 AM
Well if you end up putting something together, I'd love to take a look. I seem to learn best from example code, and to be perfectly honest, sqlite looked a bunch of mumbo jumbo to me.

Ehtyar.