Sign in to follow this  
Followers 0
Protocol

isnippet

88 posts in this topic

A simple structure in my opinion can be done this wayBranches:ID 'Auto-incrementParent ' -1 will be a root node, anything else will point to the auto-increment ID of the parentName ' Just a name for the nodeLeave ' -1 means no leave, its a regular node, anything else will point to the auto-incremental ID of a leaveLeaves:ID 'Auto-incrementDescription Code 'DescriptionETC.. 'Code or w/e is needed, module/class identifierThis structure can be rendered as a tree pretty easy and is flexible enough to create categories and reorganize them dynamically by switching the parent node. The tree is rendered from the Branches database and the snippets are pulled out from the Leaves database on demand.Edit:Attached an example, WARNING is vb6 code!!! well out of joke tree can be loaded in couple lines plain simple imo. Below is pretty much all the code needed except the connection to the DB.

Private Sub RenderTree()    Dim objRecord As Recordset    Dim sSql As String        sSql = "SELECT * FROM Branch;"        Set objRecord = m_Connection.Execute(sSql)        Dim objNode As Node        Do While Not objRecord.EOF        If objRecord!Parent = -1 Then            Set objNode = TreeView1.Nodes.Add(, tvwFirst, "key" & objRecord!ID, objRecord!Text)        Else            Set objNode = TreeView1.Nodes.Add("key" & objRecord!Parent, tvwChild, "key" & objRecord!ID, objRecord!Text)        End If        objNode.Tag = objRecord!Leave        objNode.Expanded = True        Call objRecord.MoveNext    LoopEnd SubPrivate Sub LoadLeave(lIndex As Long)    Dim objRecord As Recordset    Dim sSql As String        sSql = "SELECT * FROM Leave Where ID =  " & lIndex & " ;"        Set objRecord = m_Connection.Execute(sSql)            If Not objRecord.EOF Then        txtCode.Text = objRecord!Code    End IfEnd SubPrivate Sub TreeView1_NodeClick(ByVal Node As ComctlLib.Node)    If Not Val(Node.Tag) = 0 Then        LoadLeave Val(Node.Tag)    End IfEnd Sub

iSnippet.rar

iSnippet.rar

Edited by Cobein

Share this post


Link to post
Share on other sites

@protocol, i can try working on this too. I've been playin around with sqlite databases for a bit and i know of it a while ago because of firefox storing data into databases (pass/logins/etc). Just let me know how you would teh database to look like and provide with its tables and etc and maybe i can try whipping up something

Edited by Ixeman

Share this post


Link to post
Share on other sites

@Cobein Sorry i did not see you edited your post until Ixeman commented. I understand the concept and will try it as soon as i get some free time to have long enough of a sit down to do it rather then the current 30mins here and there when i pop on via mobile or laptop to check the forums :)

@Ixeman the way i was going to store my information is show above in the little diagram. Two tables. Please do have a go as it will help you learn more and share your experience as it will help others. Ideas like this ive got are to make life easier as a coder :)

Share this post


Link to post
Share on other sites

it has the basic principles but really far from clean routine and efficiency LOLtrying to figure out the correct mathematical efficient way to do it. code's a mess but at least i got the main idea down i guess? Is this right?attachment.php?attachmentid=615&d=1326410030

Untitled.png

Untitled.png.5a1fecee01fd7423b065e220dda6e10a.png

Edited by Ixeman

Share this post


Link to post
Share on other sites

that's sweet man, was going to give it a try this weekend, if your about and want to work on it?

have you allowed for categories? like you got vb6 can you then add lower levels for example,

vb6-->

------math--> How to do pi in vb6

-------------> How to calculate sides of a triangle

Delphi....

Share this post


Link to post
Share on other sites

hahahah delphi pft, that aint no language sahn. LOL yeahyeah, i might be busy this weekend cause of competition practice and work

Share this post


Link to post
Share on other sites
hahahah delphi pft, that aint no language sahn. LOL yeahyeah, i might be busy this weekend cause of competition practice and work

I can guarantee anything you can do in VB, I can do in Delphi alot easier and alot smaller.

Share this post


Link to post
Share on other sites

@deadly lol i was jk. im sorry if my humor isn't noticeable..

Edited by Ixeman

Share this post


Link to post
Share on other sites

hey and i was thinking, if we can get functionality for it to be working, we can possibly make it more flexible too with adding new materials to it. Like having some sort of system where users all over can keep adding into the database w/o overloading the database with junk and idk if it's a vulnerability to users if they add anything to the database but that's just an idea that the program can later add to it ya know?

Share this post


Link to post
Share on other sites

Would need to get the base functionality sorted, then you could add such functions, maybe like searching pastebin's and other code search engines. as well as connecting with a remote database from which you could down load snippets

Share this post


Link to post
Share on other sites

Im still working on my delphi implementation of this in slow time but still im working on it, I've noticed thou that using 'CATEGORY_ID Integer Primary key' causes my integer values to be negative not sure why that is and slowly googling isnt helping either, if someone can explain this I'd appreciate it. managing to add nodes to my tree-view now. Yes i know this is slow time but im working 60-84 hours a week and trying to get motivation here and there to work on it :P

Edit:

On closer inspection seems my database browser program is responsible for the negative numbers as sqlite's command prompt is insert/delete positive numbers by default. off to find a new browser for sqlite,

Edited by Protocol

Share this post


Link to post
Share on other sites

since sqlite was taking too long to work with since it's a little more difficult to use, so i started over using an access database instead. only got it to set child nodes and parent nodes according to parent id and categories they belong to. i tried using cobeins and yours kinda of concept or routine.

i think im wasting too much time to getting the thing organized instead of getting the main functionality of it lol. im sitting here trying to get the basic>math kind of thing working. i think it'll be alot simpler to keep it simple and organize from syntax first then do that stuff later cuz im getting confused with all this stuff all over the place xD

pre_1329675930__untitled.png

Edited by Ixeman

Share this post


Link to post
Share on other sites

looks good, as long as the program suites your needs doesnt matter what database software is used.

im still running with sqlite, got a bug im trying to fix when i get the time, but progress is slow im enjoying it thou which is the main thing.

Share this post


Link to post
Share on other sites

got it to get the corresponding sourcecode from the when clicking on the last child nodes (code description i guess lol) but still not clean but got most of it done i guess. this is fun learning to do :)im not sure if this is the right way to go with this though. please let me know O.o

Untitled.png

Untitled.png.1a102362db04fed5592264253a0b5de9.png

Edited by Ixeman

Share this post


Link to post
Share on other sites

Glad your having fun learning like this, This is why I try to throw as many ideas as possible out to the forum to give people different ideas or ways of doing things. looks pretty cool,

Share this post


Link to post
Share on other sites

do u think theres something i should do different ? or soemthing to improve it?

Share this post


Link to post
Share on other sites

IIGvM.png There's what i have so far :) finally got the tree working fine in sqlite lol + Time to sort it out.

as for yours. Not to sure on the collapse all button (maybe a main menu option would be nicer) as for functions/features its up to you at the end of the day, your designing a tool that could potentially help you out in the long run saving your code in one place, so searching would be a nice function to have, maybe you could add open with option to open in delphi, vb , c++ etc. Add the option to password protect individual snippets or the whole database. There are infinite possibilities all depends on how creative you want to be.

Share this post


Link to post
Share on other sites

yeah i was thinking a search capability but that's why i was asking cause im illed-creative :3

Share this post


Link to post
Share on other sites

Password protecting individual snippets will cause a problem with the search if you plan to be able to search through the code itself.

Share this post


Link to post
Share on other sites

shouldnt do with sql, have a field like IsPasswordProtected and when looping through to search check IsPasswordProtected First before doing anything else with each item also depends if you have a keyfile (like poison ivys connections) or inputbox.. Could have it encrypted as well.

Share this post


Link to post
Share on other sites

Working on adding caterogies to an already created treeview however! (yes you guessed it problem/question time)

Categroy ID has to be unique, Obviously im still working on my sql language (noob in training), if i use sqlite to generate the number (auto increment) by doing an insert.

INSERT INTO TBL_CATEGORY VALUES (CATEGORY_ID, CATEGORY_PARENT_ID, CATEGORY_NAME);

CATEGORY_ID : Auto incremented

CATEGORY_PARENT_ID : either parent or -1 (root)

CATEGORY_NAME : String for example "IntToStr Example"

If i then say added a pretend 50,000 Categories making a tree structure, at a later date removed 10,000, lets say for easy explaintion of this question, 20-30,000 do i would be left with the following:

Categories 0 - 19,999

Categories 30,001-50,000

Would the void cause a problem later on if lots and lots of add/removes take place?

Does the system reuse these lost numbers later on?

Or does the system auto-sync itself?

Share this post


Link to post
Share on other sites

why have a category id? surely the category name itself would be unique.

otherwise whats the point of categories lol

in my experience with sql, we used sequences to create an incremented id for primary keys within tables.

if items were deleted and a "void" was created this was not an issue to us.

you could just "select * from table order by id"

Edited by cswi

Share this post


Link to post
Share on other sites

You need id's for example if i had the following

C++

---Trojan

Delphi

---Trojan

you might get problems in the future telling which trojan category is which, i know you can select * and order by ID but that wasnt the point i was trying to make. Say you used this program for a year over the year you add/remove a lot of snippets and in a extreme case auto increment got to MAX_INTEGER size what would happen? you would obviously have a lot of void space as well where items have been deleted.

Share this post


Link to post
Share on other sites

8HWCu.pngtNNcQ.png

As you can see its coming along nicely, Please note this is still an ALPHA version, meaning it can and probably does contain bugs, hence why its being released "as is" as a test to help me improve it.

29/April/2012

[+] Syntax highlighting now supported using scintilla

[+] Drag and drop now supported for directories and snippets.

[*] Fixed sql injection bug from " quotes

[-] Hidden menu items i have not coded yet as this stops people from thing the application can do more then it actual can.

[*] Small amount of bugfixes not worth remembering or having their own bullet point :P Please test and leave feedback, this way i can improve this application. Good feedback would include : Operating system used, A description on how you caused the problem or bug. thanks.

Edited by Protocol

Share this post


Link to post
Share on other sites

might be a bug with the add snippet(adding/editing snippets) buttons, working on it now and should be fixed in the next hour.

Edited by Protocol

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0