Table of Contents for the terminal - kbayt.typepad.com€¦ · 15.03.2013  · On 20130202 The...

of 24 /24
Table of Contents for the terminal On 20130131....................................................................................................................................2 Start for a new hope.................................................................................................................... 2 Ajax is it the best choice?........................................................................................................... 2 On 20130202....................................................................................................................................3 The algorithm.............................................................................................................................. 3 Browser side:.......................................................................................................................... 3 Server side:............................................................................................................................. 3 On 20130203....................................................................................................................................4 The mechanism........................................................................................................................... 4 On 20130208....................................................................................................................................6 The heck with the previous solution........................................................................................... 6 The shared memory solution....................................................................................................... 6 On 20130210....................................................................................................................................7 Sample 1...................................................................................................................................... 7 The fork.................................................................................................................................. 7 Sample 2...................................................................................................................................... 7 Named pipe.............................................................................................................................7 Sample 3...................................................................................................................................... 8 Bidirectional pipe................................................................................................................... 8 Sample 4...................................................................................................................................... 8 Reader..................................................................................................................................... 8 Writer...................................................................................................................................... 9 On 20130305..................................................................................................................................10 The navigator task..................................................................................................................... 10 The aim of this study................................................................................................................. 10 On 20130307..................................................................................................................................12 Sum up of previous tests with Ajax and JavaScript.................................................................. 12 Results after modifications of JavaScript script ........................................................................ 12 On 20130309..................................................................................................................................13 The study results....................................................................................................................... 13 On 20130310..................................................................................................................................15 A study result............................................................................................................................ 15 On 20130311.................................................................................................................................. 17 Description of the study............................................................................................................ 17 Checking which where it is....................................................................................................... 17 On 20130313..................................................................................................................................18 Description of the study............................................................................................................ 18 The study solution..................................................................................................................... 18 On 20130314..................................................................................................................................20 Description of the study............................................................................................................ 20 The study by itself..................................................................................................................... 20 On 20130315 at 0213pm................................................................................................................21 On 20130315 at 0257pm................................................................................................................22 The study................................................................................................................................... 22 The solution............................................................................................................................... 22 On 20130315 at 0234pm................................................................................................................23 What is the study subject?......................................................................................................... 23 The study itself.......................................................................................................................... 23 Lexical index..................................................................................................................................24

Embed Size (px)

Transcript of Table of Contents for the terminal - kbayt.typepad.com€¦ · 15.03.2013  · On 20130202 The...

  • Table of Contents for the terminalOn 20130131....................................................................................................................................2

    Start for a new hope.................................................................................................................... 2Ajax is it the best choice?........................................................................................................... 2

    On 20130202....................................................................................................................................3The algorithm.............................................................................................................................. 3

    Browser side:..........................................................................................................................3Server side:............................................................................................................................. 3

    On 20130203....................................................................................................................................4The mechanism........................................................................................................................... 4

    On 20130208....................................................................................................................................6The heck with the previous solution........................................................................................... 6The shared memory solution.......................................................................................................6

    On 20130210....................................................................................................................................7Sample 1......................................................................................................................................7

    The fork.................................................................................................................................. 7Sample 2......................................................................................................................................7

    Named pipe.............................................................................................................................7Sample 3......................................................................................................................................8

    Bidirectional pipe................................................................................................................... 8Sample 4......................................................................................................................................8

    Reader.....................................................................................................................................8Writer......................................................................................................................................9

    On 20130305..................................................................................................................................10The navigator task..................................................................................................................... 10The aim of this study.................................................................................................................10

    On 20130307..................................................................................................................................12Sum up of previous tests with Ajax and JavaScript.................................................................. 12Results after modifications of JavaScript script........................................................................12

    On 20130309..................................................................................................................................13The study results....................................................................................................................... 13

    On 20130310..................................................................................................................................15A study result............................................................................................................................ 15

    On 20130311..................................................................................................................................17Description of the study............................................................................................................ 17Checking which where it is....................................................................................................... 17

    On 20130313..................................................................................................................................18Description of the study............................................................................................................ 18The study solution.....................................................................................................................18

    On 20130314..................................................................................................................................20Description of the study............................................................................................................ 20The study by itself.....................................................................................................................20

    On 20130315 at 0213pm................................................................................................................21On 20130315 at 0257pm................................................................................................................22

    The study...................................................................................................................................22The solution...............................................................................................................................22

    On 20130315 at 0234pm................................................................................................................23What is the study subject?.........................................................................................................23The study itself..........................................................................................................................23

    Lexical index..................................................................................................................................24

  • On 20130131

    Start for a new hopeWe try to optimize connexion with the terminal. To do that it is necessary to investigate at the web socket side. The research done drive us to JavaScript. JavaScript is a language that is client side and used by almost all browsers on the market.

    Ajax is it the best choice?As it is used with JavaScript one answer is yes. There are many web socket that use this technology. The best choice is zero administration.

    The terminal that we are working on is written in HTML (at client side). The HTML is produced with Perl (at server side). Then the result comes logically regarding Ajax. No extra to add to make this usable.

    If the browser does not support Ajax technology then we will use old version. If Javascript is not used hence no terminal at all.

  • On 20130202

    The algorithmBrowser side:

    client send a query with Ajax

    Server side:- server checks if there are tasks being monitored or

    the server exists and is pending... We have different cases:+ Task server is not up:

    ° Fork the current process. One is the server and other will become the client (see next +).

    ° If task pending execute the first created. Put result in the same file (detach process).

    ° If within 60 seconds there is no queries (tasks pending in the pool) then the server kills itself otherwise execute tasks (first created in the list). Timer is reseted when a task is finished.

    + Tasks are being monitored:° Client side write the task in a file then

    sleep (connexion is still pending when the task is not over).° Wake up when task the (file) is processed.° Then send query to client. Connexion is

    closed by peer.

  • On 20130203

    The mechanismIt is welcome to use fork, signals, and pipe mechanism.

    fork

    father childsig(chld)=ignore

    SleepProcessing query

    Wakeup

    Browser

    Browser

    Send query

    Receive query

    Ajax Connexion pending

    T0

    Tn

    WfRf

    Wf Rf

    Conexon released

  • The upper schema will introduce system mechanisms involved. No detail yet.

  • On 20130208

    The heck with the previous solutionIt works fine. If the connexion crashes file will be persistant. It take room (or space) on the disk and then clean up need to be done. A cleaner solution need to be used.

    The shared memory solutionThe shared memory solution seems to be nice.

  • On 20130210

    Programing is necessary to study which model is better than another.

    Sample 1The fork

    #!/usr/bin/perl

    my $pid=fork();

    if($pid){ print "father $$ -> $pid\n"; #while(1==1){1; }}else{$SIG{INT} = "IGNORE";print "son $$\n";}

    Sample 2Named pipe

    #!/usr/bin/perl

    use Fcntl; # for sysopenchdir; # go home$fpath = '.signature';$ENV{PATH} .= ":/usr/games";unless (-p $fpath) { # not a pipe

    if (-e _) { # but a something elsedie "$0: won't overwrite .signature\n";

    } else {require POSIX;POSIX::mkfifo($fpath, 0666) or die "can't mknod$fpath: $!";warn "$0: created $fpath as a named pipe\n";

    }}while (1) { # exit if signature file manually removed

    die "Pipe file disappeared" unless -p $fpath; # next line blocks until there's a reader

    sysopen(FIFO, $fpath, O_WRONLY)or die "can't write $fpath: $!";print FIFO "John Smith (smith\@host.org)\n", `fortune

    -s`;

  • close FIFO;select(undef, undef, undef, 0.2); # sleep 1/5th second

    }

    Sample 3Bidirectional pipe

    #!/usr/bin/perl -w# pipe1 - bidirectional communication using two pipe pairs# designed for the socketpair-challengeduse IO::Handle; # thousands of lines just for autoflush :-(pipe(PARENT_RDR, CHILD_WTR); # XXX: check failure?pipe(CHILD_RDR, PARENT_WTR); # XXX: check failure?CHILD_WTR->autoflush(1);PARENT_WTR->autoflush(1);if ($pid = fork()) {

    close PARENT_RDR;close PARENT_WTR;print CHILD_WTR "Parent Pid $$ is sending this\n";chomp($line = );print "Parent Pid $$ just read this: '$line'\n";close CHILD_RDR; close CHILD_WTR;waitpid($pid, 0);

    } else {die "cannot fork: $!" unless defined $pid;close CHILD_RDR;close CHILD_WTR;chomp($line = );print "Child Pid $$ just read this: '$line'\n";print PARENT_WTR "Child Pid $$ is sending this\n";close PARENT_RDR;close PARENT_WTR;exit(0);

    }

    Sample 4Reader

    #!/usr/bin/perl

    # Assume this file name is reader.pl

    $key = 12345;$size = 80;

    # Identify the shared memory segment

  • $id = shmget( $key, $size, 0777 ) or die "Can't shmget: $!";

    # Read its contents itno a stringshmread($id, $var, 0, $size) or die "Can't shmread: $!";

    print $var;

    Writer#!/usr/bin/perl

    # Assume this file name is writer.pl

    use IPC::SysV;

    #use these next two lines if the previous use fails.eval 'sub IPC_CREAT {0001000}' unless defined &IPC_CREAT;eval 'sub IPC_RMID {0}' unless defined &IPC_RMID;

    $key = 12345;$size = 80;$message = "Pennyfarthingale.";

    # Create the shared memory segment

    $id = shmget($key, $size, &IPC_CREAT | 0777 ) or die "Can't shmget: $!";

    # Place a string in itlshmwrite( $id, $message, 0, $size ) or die "Can't shmwrite: $!";

    sleep 20;

    # Delete it;

    #shmctl( $id, &OPC_RMID, 0 ) or die "Can't shmctl: $! ";shmctl( $id, OPC_RMID, 0 ) or die "Can't shmctl: $! ";

  • On 20130305

    The navigator taskNow a task that can be be qualified as preliminaries to the terminal program is the directory navigator.The directory navigator is a program that print in a fashion way the content of a directory through the navigator.Each navigators have their own configurations and prerequisites. In our tests we will use the following browsers: Firefox, Google Chrome, Safari, Opera, Internet Explorer. With Safari we can emulate all of the previous browsers by changing the engine used to compute codes. We will use HTML 5, Ajax. Tests can be driven on computers, or different media s.a cellulars, tablets.

    The aim of this studyWe built a time ago a program that help to watch what was in a directory. If in the directory was a file called README.pod then it printed the content of it at the end of the listing. The pod file is a a file that contains tags that can be interpreted by perl for the documentation. Then it can be traduced/translated as a man file, html. The command that translate pod to html is pod2html. At the time when the program was built (this one) there was problem of interpretation with some tags. Current version now are ok. To do a work around some perl libraries were used to make it interpreted well. The library module used was:

    use Pod::Simple::HTML;

    When a program written in pod format with an veye for instance, it was necessary to refresh with the browser each time to view the changes in this file.After 8 months this program was revised. It uses Ajax and JavaScript to achieve this task.Bugs were discovered (path management to go to the icons file) solved. Need to wait a little while to see if the program works ine. Different behaviors with browsers noticed. Need to be corrected/revised.When there was no screen refreshing with Ajax, if a file had the extension .pod and if the user wanted to see its content it was possible to watch it. Now it is not possible because t is due to a bug not solved.If we access through a mobile, there is a bug with screen refreshment with Ajax. A solution need to be found. Now if there is a file that is modified we can check its modification on the screen every n seconds (refreshing screen). As in previous version we can sort by name, by time, by size. Go from one directory to another.

  • Directory and its content

  • On 20130307

    Sum up of previous tests with Ajax and JavaScriptPreviously, tests performed and, screen flashing was noticed. Bug in the JavaScript program was detected (double call of refreshing session). Now tests need to be performed again.

    Results after modifications of JavaScript scriptTests were done near a waste land. Connexion is ok. This means no connexion lost during test period. Both tests were done on tablet tab 2 10.1 with Ice Cream Sandwich (Android 4.0) and, the cellular with Jelly Bean (Android 4.1). Both are Samsung brand and uses Android OS.

    Description of the tests Cellular TabletScreen flashing 1000ms not flashing but

    browser still pending or working (>10s) while loading data.

    1000ms not flashing but browser is going fast.

    Browsers Default browser Default browser, FirefoxComparisons between Cellular/Tablet

  • On 20130309

    The study resultsTests regarding HMI seemed OK.Now some code need to be analyzed from cellular or tablet to do so, application to watch code was downloaded. This was done on tablets but not yet on mobile.No possibility to check code on these media. Now it is possible as it is on computer to analyze code.

    Tests to change date and time of modification were done on computer. It is ok. On Celleluar it was impossible.Modification were done from tablet. I don't know it it works fine. Modification can be seen but can't check if it is refreshing from ajax or from when you switch screen.Authentication from Tablet ok but not on cellular in the wasteland.

    Modification on a file from terminal from tablet

    Modification can be seen from tablet.

  • Results of the modification seen from program that help to browse

  • On 20130310

    A study resultTests were done on wasteland. Authentication ok in wasteland from cellular. Same place as yesterday. Modification on file date and time, worked fine.

    Access to application from Cellular to terminal

  • Modification checked but same remark as yesterday regarding refreshing screen

  • On 20130311

    Description of the studyNeed to know what is the application ID and where it is executed.

    Checking which where it isThe aim of this test is to see which part of the program on the screen is static and, dynamic. When Ajax is used it is hard to make the difference where it is in the front (static) and, where it is in the back(dynamic that use Ajax).To make the difference PID were used. Then it is easy to check and watch for debuging.

    Make the difference on the screen

    The listing of the directory belongs to PID1 34836 with the REAMDE.pod file. The last line belongs to the front PID 34827. That is the static part.

    1 PID means Process ID

  • On 20130313

    Description of the studyRead pod file from the navigator witch is a CGI script written in Perl.

    The study solutionNow after working hard on how to watch pod file from navigator it is possible to watch the file from the navigator program in the browser. The trick with Ajax is to make the url call with the option bgdaem=1 in the url and call the service as usual. It is loaded in memory and then translated with an encoder and, then decoded in JavaScript document.write(...).

    Need some more work to do.

    Directory structure

  • Pod file executed

  • On 20130314

    Description of the studyThis document is a memo written with memo appli from Samsung

    The study by itselfMemo written and, taken from memo app on the cellular phone:

    BEGIN:VNOTEVERSION:1.1BODY;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:On 20130314 at 0300pm=0D=0ATests are ok.=0D=0ACheck if if we can include jquery window sliding if there is a manual in cgi file.=0D=0ANow we need to do test b4 doing that. If there is a man(ual) then print a specific icon next to the full name.DCREATED:20130314T194327LAST-MODIFIED:20130314T194327END:VNOTE

    Note from Cellular Samsung Galaxy Ace GT-S5839iRight now looking for Jquery library(snipets): http://css-tricks.com/downloads/

    http://css-tricks.com/downloads/

  • On 20130315 at 0213pmThis is what was written from the mobile:

    BEGIN:VNOTE

    VERSION:1.1

    BODY;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:On 20130315=0D=0AWhat is the study?=0D=0AChecks if the study pod file is using well Ajar.=0D=0AThe study=0D=0ALook in the code if the everything go where it should go.

    DCREATED:20130315T140224

    LAST-MODIFIED:20130315T140224

    END:VNOTE

    Copy of the text written from memo from cellular

  • On 20130315 at 0257pm

    The studyThe upper frame file is not up to snuff. Well thinkfree application if on the mobile.

    The solutionThe upper solution thinkFree office is on the cellular (OS Android and is Samsung Galaxy Ace GT-S5839i). It produces a file with the extension .docx.

    An unofficial study at this address http://forums.macrumors.com/showthread.php?t=725459 can be found to compare different flavor of Open Office. Among them is Think Free Office.

  • On 20130315 at 0234pm

    What is the study subject?Check if the pod file interpreter use right Ajax

    The study itselfLook in the code if the pod file interpreter use right Ajax.

  • Lexical index

    Lexical indexComparisons between Cellular/Tablet................................................................................................12Directory and its content.....................................................................................................................11Memo written from external devices......................................................................................................

    Copy of the text written from memo from cellular........................................................................21Note from Cellular Samsung Galaxy Ace GT-S5839i..................................................................20

    Screen copy cellular...............................................................................................................................Access to application from Cellular to terminal............................................................................ 15Modification checked but same remark as yesterday.................................................................... 16 regarding refreshing screen...........................................................................................................16

    Screen copy computer............................................................................................................................Directory structure......................................................................................................................... 18Make the difference on the screen................................................................................................. 17Pod file executed............................................................................................................................19

    Screen copy tablet...................................................................................................................................Modification on a file from terminal from tablet...........................................................................13Results of the modification seen from program ............................................................................14that help to browse.........................................................................................................................14

    On 20130131Start for a new hopeAjax is it the best choice?

    On 20130202The algorithmBrowser side:Server side:

    On 20130203The mechanism

    On 20130208The heck with the previous solutionThe shared memory solution

    On 20130210Sample 1The fork

    Sample 2Named pipe

    Sample 3Bidirectional pipe

    Sample 4ReaderWriter

    On 20130305The navigator taskThe aim of this study

    On 20130307Sum up of previous tests with Ajax and JavaScriptResults after modifications of JavaScript script

    On 20130309The study results

    On 20130310A study result

    On 20130311Description of the studyChecking which where it is

    On 20130313Description of the studyThe study solution

    On 20130314Description of the studyThe study by itself

    On 20130315 at 0213pmOn 20130315 at 0257pmThe studyThe solution

    On 20130315 at 0234pmWhat is the study subject?The study itself

    Lexical index