Source language: Translate to:

multithreading, revival inquiry, targets timer object

Post your suggestions for future versions of NeoBook

Moderator: Neosoft Support

Postby dpayer » Wed Jun 08, 2011 1:19 pm

Neosoft Support wrote:Also, I'm not sure what you mean when you say that "it can be easily done." Really?


So it is written, so it shall be done!

http://www.ask.com/questions-about/So-I ... ll-Be-Done

:)
User avatar
dpayer
 
Posts: 1384
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Tony Kroos » Fri Jun 10, 2011 6:26 am

then you might find this article interesting:
in fact, there is no need to worry so much about managing threads in vb.net, .net-framework will do the job
I'm just not sure that multi-threading is a must have NeoBook feature.
I don't know what about the other users, I just make my suggestions... The reasons why nb should have mthr seem to me worthy to consider but of course, it's up to you to decide... ok, if not, then suggest another big and great improvement which will make us happy and "feel good" )
Tony Kroos
 
Posts: 402
Joined: Thu Oct 15, 2009 3:43 pm

Postby Ferdari » Thu Sep 20, 2012 2:25 am

it could be good, if you can move/resize objects simultaneously, without pausing between movements/actions, like :

Code: Select all
DownloadFile "http://../fileone.zip" "[PubDir]fileone.zip" "HideProgress+Async" "[DownloadProgress1]"
DownloadFile "http://../filetwo.zip" "[PubDir]filetwo.zip" "HideProgress+Async" "[DownloadProgress2]"

TimerStart "Timer1" "0" "Async"
TimerStart "Timer2" "0" "Async"


Timer 1
Code: Select all
SizeObject "ProgressbarRect1" "[DownloadProgress1]*2" "-1"

Timer 2
Code: Select all
SizeObject "ProgressbarRect2" "[DownloadProgress2]*2" "-1"


This code explains itself

The timers must run simultaneously, also Internet GET,POST,DownloadFile action running in multiple threads (or real async)

this is just and example, this code not working :D, but this is called advanced programming
http://www.noten.in
We have Apps!
Ferdari
 
Posts: 32
Joined: Sun Sep 13, 2009 9:34 pm

Postby Neosoft Support » Thu Sep 20, 2012 11:20 am

I'm not sure I understand. You can run multiple Timers at the same time with the current version of NeoBook. The problem is that only one DownloadFile action can be run at a time. If you need to download multiple files and can use FTP, I would recommend using the NeoBookFM/FTP plug-in instead. FM/FTP also includes optional subroutines that can be used to easily show download progress.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Ferdari » Thu Sep 20, 2012 2:13 pm

Neosoft Support wrote:I'm not sure I understand. You can run multiple Timers at the same time with the current version of NeoBook. The problem is that only one DownloadFile action can be run at a time. If you need to download multiple files and can use FTP, I would recommend using the NeoBookFM/FTP plug-in instead. FM/FTP also includes optional subroutines that can be used to easily show download progress.


Timers run one by one, not simultaneously, or as yo say you can run two timers but, actions executes one by one, not in different threads or in background(simultaneously).

and when using Internet Actions (GET,POST,Download) it would be great if you can do multiple HTTP actions at a time, like firefox can do by default 256 connections/downloads/get/post simultaneously, also it has a detailed information of every HTTP connection like Speed, Current % percentage, file size, current downloaded size, etc, But this is not only in firefox, .NET, Delphi, Basic, C#, C++ languages, etc can do the same.

Consider it: if you are doing a internet based magazine, you need to download everything in one pass, load images, text, sound, videos etc at same time, not one by one.

Or maybe you need to do a kind of a Download Manager, all files are stored in different servers, some servers are a little slower, and this slower download blocks the publication from downloading the next files on the other servers, also the downloads stops sometimes and you cannot do anything until the slower download is finished, this is a headache. a solution must be multi-threading: If a file is downloading slower or stopped, you can do a check with a timer(on different thread) monitoring the speeds and stop them and start downloading the next file, or showing a msg etc etc, anything possible, but only with multi-threads/work-on-background/real async/multitasking or whatever you want to call it, its the same :D

Today this kind of works cant be possible on Neobook, maybe in a later future.


I hope you understand my suggestions, my English is getting worst with the time :D
http://www.noten.in
We have Apps!
Ferdari
 
Posts: 32
Joined: Sun Sep 13, 2009 9:34 pm

using WGET

Postby dpayer » Thu Sep 20, 2012 4:01 pm

Neosoft Support wrote:I'm not sure I understand. You can run multiple Timers at the same time with the current version of NeoBook. The problem is that only one DownloadFile action can be run at a time. If you need to download multiple files and can use FTP, I would recommend using the NeoBookFM/FTP plug-in instead. FM/FTP also includes optional subroutines that can be used to easily show download progress.


Have you looked at the command line utility: wget?

http://www.gnu.org/software/wget/

You can download many files at once by command line and even have it follow all links on a page (images, etc).

7.2 Advanced Usage
You have a file that contains the URLs you want to download? Use the ‘-i’ switch:
wget -i file

If you specify ‘-’ as file name, the urls will be read from standard input.

Create a five levels deep mirror image of the GNU web site, with the same directory structure the original has, with only one try per document, saving the log of the activities to gnulog:
wget -r http://www.gnu.org/ -o gnulog

The same as the above, but convert the links in the downloaded files to point to local files, so you can view the documents off-line:
wget --convert-links -r http://www.gnu.org/ -o gnulog

Retrieve only one html page, but make sure that all the elements needed for the page to be displayed, such as inline images and external style sheets, are also downloaded. Also make sure the downloaded page references the downloaded links.
wget -p --convert-links http://www.server.com/dir/page.html

The html page will be saved to www.server.com/dir/page.html, and the images, stylesheets, etc., somewhere under www.server.com/, depending on where they were on the remote server.

The same as the above, but without the www.server.com/ directory. In fact, I don't want to have all those random server directories anyway—just save all those files under a download/ subdirectory of the current directory.
wget -p --convert-links -nH -nd -Pdownload \
http://www.server.com/dir/page.html

Retrieve the index.html of ‘www.lycos.com’, showing the original server headers:
wget -S http://www.lycos.com/

Save the server headers with the file, perhaps for post-processing.
wget --save-headers http://www.lycos.com/
more index.html

Retrieve the first two levels of ‘wuarchive.wustl.edu’, saving them to /tmp.
wget -r -l2 -P/tmp ftp://wuarchive.wustl.edu/

You want to download all the gifs from a directory on an http server. You tried ‘wget http://www.server.com/dir/*.gif’, but that didn't work because http retrieval does not support globbing. In that case, use:
wget -r -l1 --no-parent -A.gif http://www.server.com/dir/

More verbose, but the effect is the same. ‘-r -l1’ means to retrieve recursively (see Recursive Download), with maximum depth of 1. ‘--no-parent’ means that references to the parent directory are ignored (see Directory-Based Limits), and ‘-A.gif’ means to download only the gif files. ‘-A "*.gif"’ would have worked too.

Suppose you were in the middle of downloading, when Wget was interrupted. Now you do not want to clobber the files already present. It would be:
wget -nc -r http://www.gnu.org/

If you want to encode your own username and password to http or ftp, use the appropriate url syntax (see URL Format).
wget ftp://hniksic:mypassword@unix.server.com/.emacs

Note, however, that this usage is not advisable on multi-user systems because it reveals your password to anyone who looks at the output of ps.


You would like the output documents to go to standard output instead of to files?
wget -O - http://jagor.srce.hr/ http://www.srce.hr/

You can also combine the two options and make pipelines to retrieve the documents from remote hotlists:

wget -O - http://cool.list.com/ | wget --force-html -i -



--------------------------------------------------------------------------------
Previous: Advanced Usage, Up: Examples
7.3 Very Advanced Usage

If you wish Wget to keep a mirror of a page (or ftp subdirectories), use ‘--mirror’ (‘-m’), which is the shorthand for ‘-r -l inf -N’. You can put Wget in the crontab file asking it to recheck a site each Sunday:
crontab
0 0 * * 0 wget --mirror http://www.gnu.org/ -o /home/me/weeklog

In addition to the above, you want the links to be converted for local viewing. But, after having read this manual, you know that link conversion doesn't play well with timestamping, so you also want Wget to back up the original html files before the conversion. Wget invocation would look like this:
wget --mirror --convert-links --backup-converted \
http://www.gnu.org/ -o /home/me/weeklog

But you've also noticed that local viewing doesn't work all that well when html files are saved under extensions other than ‘.html’, perhaps because they were served as index.cgi. So you'd like Wget to rename all the files served with content-type ‘text/html’ or ‘application/xhtml+xml’ to name.html.
wget --mirror --convert-links --backup-converted \
--html-extension -o /home/me/weeklog \
http://www.gnu.org/

Or, with less typing:

wget -m -k -K -E http://www.gnu.org/ -o /home/me/weeklog


User avatar
dpayer
 
Posts: 1384
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Neosoft Support » Fri Sep 21, 2012 11:17 am

Multithreading is really an advanced programming concept which may be beyond the scope of what NeoBook was intended to do. There are many limitations on the kind of things you can do within a thread. One example: whenever you want to update something on-screen, you much temporarily suspend the thread, update the screen, then restart the thread. Threads work really well for performing complex calculations and background tasks. With foreground tasks, the need to leave and enter the thread multiple times can greatly impact their normal advantages. Most NeoBook actions update the screen in some way and wouldn't benefit from threading.

From Wikipedia:

On a single processor, multithreading generally occurs by time-division multiplexing (as in multitasking): the processor switches between different threads. This context switching generally happens frequently enough that the user perceives the threads or tasks as running at the same time.


One place where multithreading might be an advantage would be background tasks like download a file via HTTP. However, I'm not sure you get as much benefit as you think since all of that data has to go through a single Internet connection. What probably happens is that the threads end up waiting for each other's data to pass through the port. It's probably measurably faster than downloading all of the files in series, but not as fast as really downloading everything simultaneously.

NeoBook's Timer object, which are derived from the standard Windows timer component, is message based and operates similar to context switching. Essentially NeoBook tells Windows to create a timer. The timer runs in the background and waits a specified number of milliseconds then triggers an event. In NeoBook this event executes the Timer object's associated action. Depending on how multiple timers are used, you can actually see (in the debugger) two timers execute their actions simultaneously (or nearly so).

Consider it: if you are doing a internet based magazine, you need to download everything in one pass, load images, text, sound, videos etc at same time, not one by one.


Why wouldn't you just display the magazine in a web browser and let the browser download all of the files?

Or maybe you need to do a kind of a Download Manager...


That might be an excellent idea for a plug-in. I could be wrong, but I'm not sure it's needed enough to be included as part of NeoBook.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby dec » Fri Sep 21, 2012 12:56 pm

Hello there,

If anybody need to create runtime timers list can take a look at my npCron plugin. Thanks. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Previous

Return to NeoBook Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests