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: (7) </ 1 2 [3] 4 5 6 7 >/

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

new topic new poll
Topic: DSL v3.1 RC2< Next Oldest | Next Newest >
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Oct. 27 2006,17:33 QUOTE

That "test" together with the io.input actually opens the file twice. Once in the test which then closes it, then again with the following io.input. I would rather to use io.open to which will allow control of error condition. Also, I would rather try to stay as generic Lua/Fltk as possible. Some of those tests as well as many others could also be easily added to our own functions5.lua. But then again, it becomes easy to use and not realize the overhead of what is happening, opening and closing files. If it were at the Lua base level via the os library then I would not have such concern. But then again that is my way of thinking.
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Oct. 27 2006,17:39 QUOTE

Quote
it becomes easy to use and not realize the overhead of what is happening, opening and closing files
true. I usually think primarily about file size and noticeable performance differences, and not so much about what is actually happening. I'm sure it would be much more noticeable in a larger application running on a slower machine.

EDIT:
Would something like this work better, or am I doing the same type of redundant work?
Code Sample
 dotmydsl=io.open("/home/dsl/.mydsl")
 if dotmydsl then
   mydsl_dir = dotmydsl:read("*line")
   io.close(dotmydsl)
 else
   mydsl_dir = "/"
 end


--------------
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: Oct. 27 2006,20:51 QUOTE

mikshaw, YES, now that's what I am talking about.
I prefer that approach.

But, I still don't really like the failover to /, which was my original post.
But "load local" is more than likely in lieu of the auto loading via the autoscanned "mydsl dir" or the boot time option of "mydsl=xxxx". So, I guess that failover shall remain until it becomes set via user navigation.


Edited by roberts on Oct. 27 2006,20:59
Back to top
Profile PM WEB 
jls legalize Offline





Group: Members
Posts: 476
Joined: April 2004
Posted: Oct. 28 2006,23:46 QUOTE

1) I don't really understand why we need /opt/.dslrc and /home/dsl/.mydsl.
2) Due to error in loading unc via mydsl icon I've changed /usr/bin/mydslinfo.lua to
Code Sample

#!/bin/murgaLua

-- (c) 2005, 2006 Robert Shingledecker
-- myDSL info display usually called from mydslBrowser

dofile("/etc/init.d/functions5.lua")

function parseInfo(infofile)
 local i,j = string.find(infofile,".info")
 if not i then
    return nil
 end
 local basename=string.sub(infofile,1,i-1)
 local k,l = string.find(basename,'.dsl')
 if k then
    return basename
 else
    m,n = string.find(basename,'.uci')
    if m then
       return basename
    else
       o,p = string.find(basename,'.unc')
       if o then
          return basename
       else
          return basename .. '.tar.gz'
       end
    end
 end
end

-- Main
if #arg == 2 then
  library = arg[1]
  infofile = arg[2]
else
  print("usage: mydslInfo.lua [library_name infofile_name]")
  os.exit(1)
end

os.execute("pkill mydslBrowser.lua")

mirror = getOption("/opt/.dslrc","Mirror")
protocol = getOption("/opt/.dslrc","Protocol")

os.execute('wget -q '..protocol..'://'..mirror..'/mydsl/'..library..'/'..infofile)

wWidth=500
wHgth=290
w = fltk:Fl_Window(wWidth,wHgth,infofile)

browser = fltk:Fl_Browser(0,0,wWidth,wHgth-30)
if not browser:load(infofile) then
  print("can't load ", infofile)
  os.exit(1)
end

cancelBtn = fltk:Fl_Button(180,wHgth-28,70,25,"&Cancel")
cancelBtn:shortcut('c')
cancelBtn:callback(
function(cancelBtn)
 os.remove(infofile)
 os.exit(0)
end)

downloadBtn = fltk:Fl_Button(255,wHgth-28,70,25,"&Download")
downloadBtn:shortcut('d')
downloadBtn:callback(
function(downloadBtn)
 extension = parseInfo(infofile)
 os.remove(infofile)
 os.execute('mydslDownload.lua ' .. library .. ' ' .. extension)
 os.exit(0)
end)

w:resizable(w)
w:show()
Fl:run()

Back to top
Profile PM WEB ICQ MSN YIM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Oct. 29 2006,01:50 QUOTE

I concur, good job, and thanks for your interest in testing.

1. I believe you meant /opt/.mydsl_dir which I have already made this change.
Back to top
Profile PM WEB 
31 replies since Oct. 24 2006,23:14 < Next Oldest | Next Newest >

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

Pages: (7) </ 1 2 [3] 4 5 6 7 >/
new topic new poll
Quick Reply: DSL v3.1 RC2

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