Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - unixtechie

#1
Whither newLISP? / Re: How to get newLISP popular?
February 06, 2013, 11:36:21 AM
Quote. Developing a portable, embedded social network device. Something like "Facebook to Go" using newLISPs networking functions, because I think the discussions about personal data and privacy will become more active.


OK, one year ago I worked out in detail the design of a node that would do the following:



--It is invisible from the outside, i.e. a scan won't show any open ports. This feature can be used to protect the node from DoS attacks, among other things.



-- It however listens and accepts (encrypted) packets from people registered with the site

Upon receiving packets on a correct port it will publish them on it internal web site, if the encryption key is acceptable, pretty much the same way twits are received and published.



-- this "internal website" may be open on localhost only, or be visible from the outside. In any case, it is a "passive" web server serving static web pages (i.e. fast and so on) which does not take any input from the outside. All publishing happens via the first mechanism.

So in case of a node open to the outside world for reading, a scan will see this static web server port only, no listener waiting for input is visible to the scanner.



-- the size of the messages is up to roughly 600 bytes, i.e. a couple of small paragraphs, i.e. postings can be considered to be  "super-twits" in a way, as twitter allows only (150?) symbols, and is pretty useless.

It is not difficult to make these messages longer in size, too.



-- the messages are published either in each registered user's blog, or can be comments under other users' entries. Access policies (all registered, friends only etc) are possible.



-- there are more possibilities for this architecture, I will skip discussing them for now



THIS PROGRAM - according to my thinking - can be cross-platform; it all goes/unpacks into one directory, and the programs themselves are maybe 2-3 megabytes in size total. They consist of a small number of standard unix/... utilities plus a binary of newlisp (maybe packed with its own script into a standalone pseudo-binary, as newlisp can do), which glues their functionality into a coherent whole.



This architecture can process probably 100 messages per second, turning any computer into a super-twitter or blogging  node. It can also be scaled over several machines to create a more powerful site.



Such a node could be used as a  sort of multiuser blog  with comments, "DoS protected", as no ports are open for input -- or as a hidden engine for friend-to-friend messaging, or a combination of both, creating a basis for decentralized social "chirper" sfw (where chirper is defined as a sort of super-twitter for friend-to-friend networking), or a full-blown network of blogs which combine opennet and darknet capabilities, traffic from the former creating cover for the smaller darknet traffic.



This functionality can be hidden behind a regular website, which supposedly is totally "passive" and serves static pages only.



NEWLISP in that design would be a cross-platform glue language, and maybe even the webserver itself for localhost private messages reading (the built-in webserver library I remember crashed under heavy traffic, so it might be wiser to use a small standalone web server binary for public nodes)
#2
ah, 'tcc', a brilliant piece of software (by the author of QEMU emulator), which allows on-the-fly compilation and execution.



There exists a whole web server based on tcc, which is number one in speed comparisons (pushing several hundred thousand responses per second), called G-WAN.

The authors distribute it as a compiled bundle, do not allow to look inside nor change anything, but at the same time give it away for free and prohibit charging money for it.



That server does static pages of course, but relies mostly on tcc on-the-fly compilation for the 'application server' part of it. This whole speed champion server is scripted in C, which scriplet handlers or filters are included as a source code and rely in the built-in tcc to run.



Actually, taking one of the sample C scriplets and slightly modifying it one could turn Newlisp into a persistent server language for G-WAN.

They could communicate over a pair of pipes, as one example, with web headers and (RESTful) requests sent over in the simplest format possible.



One could go the other way, i.e. compile and include newlisp as a shared library into the G-WAN file hierarchy, so that C scriplets would be able to use embedded newlisp from C - but somehow that seems to me a more cumbersome approach.



http://gwan.ch/">http://gwan.ch/

.
#3
newLISP in the real world / TCO trampolining and stuff
December 27, 2011, 06:26:29 AM
I have not thought about it, nor tested, so the link might be kind of irrelevant, but:

here's what looks like a solution via closures (which are possible in newlisp):

http://www.windley.com/archives/2008/11/tail_optimized_mutual_recursion_in_clojure.shtml">http://www.windley.com/archives/2008/11 ... jure.shtml">http://www.windley.com/archives/2008/11/tail_optimized_mutual_recursion_in_clojure.shtml

and the original is here:

http://groups.google.com/group/clojure/tree/browse_frm/thread/6257cbc4454bcb85/7d5fd827cd549080?_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2F6257cbc4454bcb85%2F7d5fd827cd549080%3F">http://groups.google.com/group/clojure/ ... d549080%3F">http://groups.google.com/group/clojure/tree/browse_frm/thread/6257cbc4454bcb85/7d5fd827cd549080?_done=%2Fgroup%2Fclojure%2Fbrowse_frm%2Fthread%2F6257cbc4454bcb85%2F7d5fd827cd549080%3F&
#4
newLISP in the real world / New Year wishes for Newlisp
December 26, 2011, 11:16:54 PM
Well, here's my new year wish.



I wish to crown the new libffi functionality with its application to the Zeromq messaging library (0MQ, zmq).



The combination could open breathtaking opportunities for newlisp scripting, basically providing the core of Erlang functionality in 300k+300k+1.7M = Erlang in <2.5 MB without a need of "system installation" of 127 MB and 5000 files, and cross-platform, if newlisp glue is written with care.  Just drop 3 files into any directory.



Combined with Mongrel2 web server (which is a thin 'gateway' to Zeromq messaging in effect) could allow creation of distributed scalable and (if 'supervising' is implemented in your scripting) reliable web appls, which are blasingly fast.



Newlisp Zeromq messaging - if tests are successful -  could then be wrapped into Erlang OTP-like APIs.  And we'll get "newERLisp" ;))))



I'll try to do some test scripting during these holidays (which in some countries last until Jan 10 ;))) ) and tell about the results.



p.s. Zeromq book ("the Guide") with patterns of usage at http://www.zeromq.org">http://www.zeromq.org

http://zguide.zeromq.org/page:all">http://zguide.zeromq.org/page:all



p.p.s Plenty of languages, including all major scripting ones, already have their interfaces/APIs to the 0MQ messaging library.

What is unique about Newlisp is that (with its internet server mode, net-eval, and procreation of offspring processes combined with messaging from parent to children etc.) already has the erlang-like infrastructure for launching and managing the stuff built in.

While in other langs that would require effort, loading extra "modules" (created as fronts to other libs) etc.



And the major advantage Newlisp offers is "0 installation" and its ability to create "pseudo-executables" by packing the script with the interpreter in one small file.



So - is a 2MB new_erl_lisp  possible?
#5
newLISP newS / Re: newLISP development release v.10.3.9
December 26, 2011, 11:03:53 PM
no, unfortunately the problem is still there.

Opening Code Patterns and the Manual in any web browser and making a search in the page for "struct" as one word  will show a number of uses in which "struct" is a var name, not a newlisp operator.



It's not worth it to list the conflicts here, and probably unnecessary to supply a patch - the search will highlight them all and the fix should be very quick.
#6
Whither newLISP? / Erlang-like OTP in newlisp??
November 17, 2011, 01:48:06 AM
Hello, newlispers. Have a question to you.



I remember how much impressed I was after reading books by Armstrong and some other on the concepts implemented in Erlang. And even more impressive (than pure Erlang) is the idea of OTP, a generic framework for fail-proof distributed computing.



Today with the new messaging capability btw parent and spawned children enabled in newlisp, it seems possible to implement the same OTP logic purely in newlisp.



It's reasonable to take a primitive example - e.g. downloading in parallel from some web-based repository    - and then implement a "generic tcp server" with callbacks, that make it possible to "program linearly" from the parent, then implement "supervisors" which (like the unix inetd) spawn, rip, restart childred which do the actual work (downloading in our example) in parallel.

Then make it the same for spawing local children or starting remote newlisp workers.

At this point I can imagine how the previous could be approached; I'm less sure - but maybe even the on-the-fly code updates might be possible who knows.



Of course, real processes spawned by newlisp will be heavier that pseudo-processes generated by an erlang virtual machine, but still this approach may make full sense, I think.



Would it be worth it to try this example - with the view of creating a more generic framework (a pure newlisp lib file) if it works OK? Would this be interesting?
#7
newLISP in the real world / Re: C XML parser to newLisp
December 07, 2010, 11:29:09 AM
mm..



(a) newlisp can directly use functions from C libraries.

If your parser can be compiled as a library, then the chances are it can be directly called from a newlisp script



(b) newlisp includes some kind of XML parser already.



I'd check first if these two roads are possible for your purposes, although I am not acquainted with your project and do not know that, of course.
#8
newLISP newS / Re: Lispeln - Newlisp fork.
February 12, 2010, 09:02:40 AM
1. wow

2. you almost caught him in the act: "registered 18 hours ago"

3. Lutz (and us, in case some crowd attention is needed) should review the man's actions: his fork is published as if existing under GNU Affero GPLv3,  while the original is straight GPLv3



i.e. he relincensed it (and those are not exactly the same)



It remains to be seen, whether this is a good effort to extend newlisp, or an attempt to parasite on a long-living and quite polished project. If the man wants to enhance newlisp, why did not he offer his work here first?



Might be some part in the generalv tendency in Asia to "own" technologies created by others. I hope not, and this is an honest attempt to develop newlisp further.
#9
newLISP in the real world / No specifications still
December 27, 2009, 11:26:49 PM
still there is much talk "about" the issue, but no specifications.

Tell using very short one-line examples what is input and what is the expected output - otherwise all talk is useless.



Supposing you got this as input:



<fieldset><legend><a href="javascript:;" onmousedown="toggleCombined('18');">
<font class='lnum'><i>(18)</i></font>&nbsp; Markup of code and documentation sections </a>&nbsp;<font class='lnum' size=-1><sub><i>(line 962)</i></sub></font> <font size=-2><i><a href='#tocancor'>toc</a></i></font><a name='18'></a></legend></fieldset>
<p>
<div id="18" style="display:none">  
<p>
    <b> <i> Markup </i> </b><br>
</div>
</fieldset>


What do you expect as "correct"  output for your task?

Please explain what you are expecting.
#10
newLISP in the real world / do not understand
December 27, 2009, 02:23:16 AM
do not understand at all what you are trying to do here.



1. If you need to separate tags from text, then:

(a) "canonize" the text by adding  "n" (newline) after each ">"

(b) consider each line in the substituted text your needed outcome.



That's it.



This is implemented with exactly 2 operators, "read-file" and

"replace", then read the modified buffer string line-by-line with something like "regex" with offsets.



2. If  you do not wish to slurp the file into memory,

(a) use "search"  to get to needed positions and "seek" to keep a list of offsets,

(b) next read your strings jumping between the known offsets.



That's all.



You write in abstractions - can you give primitive examples (input - expected output) of what you are trying to achieve?
#11
Well, Kazimir, you sound as if it all is a big deal. It is not. Probably I myself am guilty: when I was writing the Molly script, I  was too wordy (testing how various tricks would look in the output). I should probably cut documentation (part II) to 20% of what it is.



Because using this stuff is incredibly easy.



I looked at your links; the google cache failed on me, and so I do not know if you also mentioned CLWEB, a lit prog add-on for Common Lisp.



Those guys twist the original idea to use it with REPL. I have not touched those tools at all.



To answer your question: I am not exactly planning, I've done it - ;)) -  and the tool does not depend on the language of machine code. Moreover, one can view it as an extension of the "noweb" tool, an alternative folding html weaver for it. (Although now it has a built-in tangler and is self-contained too).



And yes, I used the <<chunk name>>  for chunk names in definitions and references..



Well, look at the template file in the distribution (there is a button above the file list on the GitHub page that will download a full tar.gz archive of the depository).

It is a very, very simple notion and it's very simple to use.  A 10-minute trial with the template file will give you a good idea of how it feels.
#12
Kazimir, it is not "documentation"



Let me give you another definition of "literate programming":



1. It is writing code from specifications in a human language

It's not documentation that you produce. You begin programming by thinking of what a piece of code should do, then writing it down:

loop over lines of a target file

filter out non-code sections

process the code



Now,  you continue to think in "human":

mm.. all I have to distinguish is headings, ends, body and references (I am talking about the program that implements literate programming parsing itself, of course):



<<process the code>>=

<<process headings>>

<<...>>

...

@



While you specify and implement, you add your commentaries alongside the code itself ("real" code and pseudocode references).

But those commentaries are NOT DOCUMENTATION. They are notes for you, the programmer, of your own thoughts, the references you need, some points you'll need to add, alternative ideas of how to implement etc. etc.



Another point is that you do it in the order your thinking imposes, top-down, bottom-up, or any mad sequence your brain demands. You do not bend your mind to think in the order of machine codes.



One more big point is that, your notes not being documentation, you are NOT OBLIGATED in any way to produce them. If a piece of code is obvious, you just write it out as code, without employing pseudocode insertions or comments alongside. You start breaking code when some piece interferes with the general flow, to postpone it.

So you can write down some idea more fluently, without getting bogged in the details of implementation of some of its parts.

You can always do them later.



I basically try to break code into pieces (a) to postpone, or (b) when I do not understand clearly how to write some snippet and flip back to the "writing from descriptions in a human lang" mode.



So: "programming from specs in a human language" or "programming directly in pseudocode" is good. We all know that pseudocode is good and highly understandable, as most if not all textbooks are written in this way. We learned the discipline of programming by reading "literate programs" in some sense on the first place.



2. Now, the demand that a literate program looked like a "polished essay" is a big psychological block and must be disposed with from the beginning.

However  your haphazard notes DO BECOME good documentation as you go along and refine the code.



They remain great documentation for you yourself, the author, all the time - you can restart your thinking immediately at any point. There is no situation when, a week or two later, you have to remember what the heck it all meant. Many programmers on the Net state that a month after writing a piece of code they are unable to really read it.



But to return to the original point of this paragraph, these haphazard notes do become good documentation as you refine your code, delete helpless question, and leave only what is relevant. And you NEVER actually WROTE any documentation at all - a task again many (myself included) feel is psychologically discouraging. It all got produced "by itself", as a by-product of your thinking.



3. This way you drastically increase the SCOPE of your ATTENTION. A "regular" program becomes a strain at roughly 1000-1200 lines of code. A programmer has to keep a mental picture of his code to navigate and know which parts need to be changed when  he is further developing the existing design.

 

The outline prevents that mental strain from happening.



I look at my code and notes, immediately produced, in a web browser, while I am doing my thinking. Then I get to the referred line in the editor, and do changes, reload the page (Ctrl-R), and look and think again.

It was a surprise for me how much my brain got relieved from "housekeeping tasks", remembering, straining etc. when the script was functional enough for me to switch to using it.



4. In a way that answers your  question how applicable L.P. could be to larger programs.

(a) outlining added to "traditional" LP greatly increases scalability. Everything not relevant to the task at hand is folded out of way, even if it is megabytes of code (as long as your web browser does not choke)

(b) A Literate Source file, like the file you were reading, "MOLLY.html", can be split mechanically into parts if code grows uncomfortably large (e.g. if the TOC section becomes unwieldy)

Just feed all spliter file names to the tangler, and your code will be produced correctly:



"MOLLY.pl/notangle -R 'root chunk name' splinter1.litsource splinter2.litsource ... > my.code.txt"



(c) L.P. was invented by Knuth who is famous for painstaking thoroughness in his programming. He created a huge program, TeX, by using L.P. techniques.



(d) In a way, pseudocode referencing is an alternative to creating artificial functions/procedures in languages, when and where they are used not because computing demands it (e.g.  for recursive calls), but just as a crutch for human memory limitations - "I'll have to stick this into a subroutine, or I won't remember how to use it in the sea of code my messy program will become".



In that sense, L.P. deserves to be called "another paradigm" of programming. In fact, it's just simple macro programming, allowing to use specifications in human, which become precise new operators of the introduced meta-language.
#13
Yes, the terms "weaving" (producing formatted document from the Literate Source file) and "tangling" (producing source code to be run, if it is a script language, or compile) are standard in Literate Programming.



If you'd like an overview, read a Wikipedia article (which, incidentally, was written by me, too ;))))) ) at

http://en.wikipedia.org/wiki/Literate_programming">http://en.wikipedia.org/wiki/Literate_programming



Basically, "L.P." is "writing programs in pseudocode" with phrases in a human language, which stand for other phrases and/or machine code.

Literate programming tools allow one to write source and his thoughts in _arbitrary order_ (not the one imposed on you by the machine).



But basically, look at the MOLLY.html as an example of "weaved" formatted document, and then try yourself to get documentation, MOLLY.html and the code for the module, MOLLY.pl, by running the tool on the Literate Source file (MOLLY.weave in the distribution). Do not clobber the existing MOLLY.pl, though, give it a different name.



The sample file "MOLLY.weave" is written in "dot-html", which I'd discourage. Write your LitSource in regular HTMl, which is default now. Use the project template as your guide.



The Molly tool is not programming-specific, though, and the approach can be used for any project, even writing literature, if you wish ;).



-------------------



Basically, re-coding this in newlisp will make a truly standalone pseudo-executable with an embedded web server, which it will be possible to generate for any major platform.



so, yes, please look at it and tell me if in your opinion the tool is worth it.
#14
I posted this first as a response in a previous post by Kazimir about some newlisp project at github, but let me repost this question.



So, regarding "projects in newlisp on Github":

Could you please look at http://github.com/unixtechie/Literate-Molly/">http://github.com/unixtechie/Literate-Molly/

This is a perl script for literate programming, which extends it with HTML and Javascript "folding" to help manage programmer's attention span and scale the previously unscalable flat literate source files.



It can be recoded in newlisp to become a totally standalone tool, when turned into a newlisp pseudo-executable, without reliance on any "system instllations" of any other tools, nor a web server.



Give me your opinion, Kazimir and other readers, do you think it's worth it?



Read the "MOLLY.html" file first, it's both an example of the weaver output and a sort of documentation of the script and its usage.
#15
hmm..

It's great someone else discovered newlisp.

One thing is there are literally hundreds if not thousands of editors, and it'll be some time before this one reaches functionality of the better-known ones. Even though this one is language-specific, and the others (like Vim I use, even "geany") are generic.



I love open source movement, sometimes it looks like it's the only remaining outlet of creativity in the the world choked by corporations. However the tendency of OS-ers to reinvent wheels is amazing. Effort could be much better directed if it adds to an existing project, extending it, or if you are creating something different.



So (as I was taught that "criticism must be constructive") here's my own suggestion.

Look at http://github.com/unixtechie/Literate-Molly/">http://github.com/unixtechie/Literate-Molly/

This is a perl script for literate programming, which extends it with HTML and Javascript "folding" to help manage programmer's attention span and scale the previously unscalable flat literate source files.



It can be recoded in newlisp to become a totally standalone tool, when turned into a newlisp pseudo-executable, without reliance on any "system instllations" of any other tools, nor a web server.



Give me your opinion, Kazimir and other readers, do you think it's worth it?



Read the "MOLLY.html" file first, it's both an example of the output and a sort of documentation.