Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (16) </ [1] 2 3 4 5 6 ... >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: MyDSL info parser, prototype< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 13 2008,15:39 QUOTE

Quote (roberts @ Jan. 13 2008,01:35)
Also note that I am also now updating a Master List of all extensions.
Use your browser to search it, or download it and use Beaver to search it. Or have fun with grep.


Here's a simple gui that can be used to parse this file, currently by filename, package builder, or extension category.

NOTE: This is a quick test, and should not be considered complete or stable.
The list.txt file must be saved locally
The application must be run from a terminal in order to view any output
Text parsing needs work. The "filename" in particular could be handled better...it will accept Lua string patters, but needs further testing to determine whether certain input could be harmful.

Code Sample
listfile="list.txt"

inputfile=io.open(listfile)
if not inputfile then
 print("can't open "..listfile)
 os.exit(1)
end

data=inputfile:read("*a")
inputfile:close()

function parse_info()
if radio_buttons[1]:value()==1 then searchstring="Location:%s*"..inputs[1]:value()
elseif radio_buttons[2]:value()==1 then searchstring="\nExtension.by:%s*"..inputs[2]:value()
elseif radio_buttons[3]:value()==1 then searchstring="\nTitle:%s*"..inputs[3]:value()
else searchstring=nil
end
if searchstring then
for info in string.gmatch(data,"(Location:.-\n)Location:") do
if string.find(info,searchstring) then
print(info.."\n..........\n")
end
end
end
end

w=fltk:Fl_Window(350,200,"MyDSL Info Search")

radio_labels={"category","extension by","filename"}
radio_buttons={};inputs={}
for i=1,table.getn(radio_labels) do
radio_buttons[i]=fltk:Fl_Radio_Round_Button(10,20*i,100,20,radio_labels[i])
inputs[i]=fltk:Fl_Input(120,20*i,200,20)
end

gobutton=fltk:Fl_Button(10,100,100,20,"go")
gobutton:callback(parse_info)

w:show()
Fl:run()


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Jan. 13 2008,16:18 QUOTE

Hi mikshaw,

I was going to do something here, but I am glad to see that you have started! This could be a replacement to the current box of buttons that I original did.

I was thinking of something along the lines of QBE (Query By Example). Where each field of the info file is displayed as input fields. Then search the list.txt testing each field for corresponding input fields. Display the results in a gui selection list. Then user can scroll results in the GUI and if select Title: field then use its postion -1 to get location. Then easy to feed mydsl-load. Of course, if the use selects something other than title field, display error with help, or iterate backwards to the title field and construct title location to feed mydsl-load.

Finally add a file browser to provide the Load Local feature and we could have a replacment to the existing box-of-buttons currently known as mydsl browser.

If a QBE form is created then it could also be used to create new .info files for those wishing to submit new extensions.
Back to top
Profile PM WEB 
lucky13 Offline





Group: Members
Posts: 1478
Joined: Feb. 2007
Posted: Jan. 13 2008,16:31 QUOTE

Quote
I was thinking of something along the lines of QBE (Query By Example).

Does murgalua have functional sqlite bindings? I looked at the site but the links to examples and sqlite are broken.


--------------
"It felt kind of like having a pitbull terrier on my rear end."
-- meo (copyright(c)2008, all rights reserved)
Back to top
Profile PM WEB 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Jan. 13 2008,16:58 QUOTE

Yes. murgaLua does. I tried importing this into an sqlite db but was only about 90% successful. The comments are full of odd characters that break things. Using blobs might help, but then not sure of search capabilities. Does 750 items warrant using an sql database? It would be easy moving forward. It is the past 10% of the data that is difficult.
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 13 2008,17:04 QUOTE

I have no experience with or current knowledge of using databases of any kind, but as far as I understand, sqlite is useable in murgaLua.

I've read the QBE explanation 3 times now, and still don't follow it =o)
But I assume it is directed mainly toward the ultimate goal of obtaining the url for a specific extension, which I suppose would be the main purpose of a tool like this. I was just doing it for the sake of figuring out how to grab the text of a specific info file or files, without a solid plan of actually putting that information to any useful purpose.

I'll have to save this thread for further digestion.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
76 replies since Jan. 13 2008,15:39 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (16) </ [1] 2 3 4 5 6 ... >/
reply to topic new topic new poll
Quick Reply: MyDSL info parser

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code