Stories
Slash Boxes
Comments

SoylentNews is people

Log In

Log In

Create Account  |  Retrieve Password


What's the Best General purpose RAD language...

Posted by gishzida on Wednesday February 26 2014, @10:24AM (#101)
5 Comments
Code
for a casual programmer?

Perl and Python are not good languages to use for a "casual programmer" such as myself. My reasons are as follows:

Their learning curve is steep.

They require an external "runtime" and /or libraries.

They cannot "compile" a stand-alone executable [using wrappers makes the process too complex]

What are the alternatives?

"Scripting" Languages have many limitations. I've used TCL/Tk, Perl, Python, JavaScript. Of these TCL/Tk is the easiest to use simply because TCL is pretty straight forward [within its limitations] and Tk is integrated with TCL so building user facing windowing apps was fairly simple. None of the other languages noted above are as "easy" to write in as they were written for purposes other than human readability or easy functionality. "Back in the day" I used the IBM Basic compiler [MS basic compiler], Turbo Pascal, Realizer [AKA CA-Realizer was a Win31 / Win95 basic compiler that Computer Associates bought and then let MS kill http://en.wikipedia.org/wiki/CA-Realizer ] to write actual "production release" software. More recently I have used both FreeBasic and FreePascal.

I'm one of those foolish oldtimer's that think that OO languages add needless complexity while not actually providing added value to Rapid App Development. So talking C++, Java [and variants] and other OO languages at me is pretty pointless.

JavaScript is said to be the "coming thing" except it seems that it suffers from dialect fragmentation / implementation issues [Anyone remember how MS broke things with its own version of Java?] and last I looked it also had "math issues" [i.e. math is not done by simple expression "A=15+6" there is no specific number types-- Number is too general]

Many years ago [1998?] I wrote an app with JavaScript to run in the original Netscape browser that read in data, processed it and then wrote to disk the results. It was a bitch to write. I did it despite poorly documented features [disk reads and writes at the time were "supposed to be sandboxed". It turns out they were not. I am unconvinced that JS is actually a way forward since it was not designed to be a "general purpose" language.

I'd love to hear what others think the best general purpose language is for a "casual programmer".

Travesty Generators

Posted by gishzida on Wednesday February 26 2014, @08:57AM (#100)
3 Comments
Code
Recently I looked in my "old code repository" to see if I had the source for "A Travesty Generator for Micros" from Byte Magazine [November 1984]. I did not find the code for the Byte version of Travesty but I did find a couple of old DOS apps: Markv and "Babble!".

MarkV is a markov chain text twister written in C. The most famous of the Markv versions was an IRC / USENET bot that emitted posts and comments. For an example of what MarkV can do to a list of "wisdom quotes" see http://markovswisdom.blogspot.com/2014/02/the-book-of-markovs-reminders.html

"Babble!" was a closed source DOS "shareware" app from the 1990s that allowed multiple Markov chains from a maximum of 4 text source travesty streams to be mixed into a single output stream. An example of this can be found here: http://markovswisdom.blogspot.com/2014/02/markov-and-shakespeare-reveal-wisdom-of.html The output combines a small snippet of the "wisdom quotes" + "Hamlet" + Jabberwocky" + "Romeo and Juliette". The problem with the version of "Babble!" I have is a) it is closed source and b) the shareware is crippleware in that the text streams are very limited. I'd very much like to have or develop a useable version of this.

Unfortunately there do not seem to be too many "modern" open source "travesty generators" available and those that I have found are not written in programming languages [Perl, Python] that I am a fluent programmer [which is to say I find neither Perl nor Python are not casual programmer friendly... but we'll save that for another journal entry]

One other thing I have noticed is that there do not seem to be too many "modern" implementations using Markov Chains and other methods to twist text available.

Anyone know where I can lay my hands on source code for "text twister" or Travesty generators?

Mars, Ho! Chapter One

Posted by mcgrew on Tuesday February 25 2014, @03:35PM (#94)
0 Comments
/dev/random

Prologue
        I don't know why they're making me write this damned report, I never had to write a report before. Ain't like I been to college or nothing. I didn't have to write a report after Vesta, why now? Maybe because this trip was so damned out of the ordinary? I don't know, I'm just talking into this thing and I don't know where to start, so I'll just start.

The Meeting
              I was scared shitless; the CEO had called me into his office. Jesus, the fucking CEO! Why would a CEO want a lowly boat captain to talk to him? Yeah, centuries ago ship captains were really important guys, but that was back when they needed crews. I was a glorified bus driver and babysitter.
                I liked hauling passengers because at least I'd have somebody to talk to. It takes a long time to get from planet to planet, and it's usually a boring trip. They pay pretty damned good, too -- cargo boats don't need babysitters.
                Jesus! The CEO! I was shaking as I walked into his office. If I was going to get fired for that little incident on Vesta my chief would have sacked me.
                "Have a seat, Mister Knolls. Coffee?"
                "Uh," I said, "Uh, thank you, sir." I fidgeted in my chair. His assistant gave me a cup.
                "Knolls, your supervisor told me all about Vesta."
                I almost pissed my pants. Shit, they were going to sue me.
                "That was some damned good work, Knolls."
                My head kind of exploded. "Sir? Two men died!"
                "Yes, Mister Knolls, but you saved ten million dollars in equipment and the wrongful death suits were only a million each. God damned good work!"
                "Uh, thank you, sir," I said, wondering how damned evil this man could be.
                "I have a new assignment for you," he said. "Your supervisor told me you didn't like cargo runs, but this time you'll have someone to talk to."
                My head kind of stopped working right then.
                "This assignment is important. You're the man for this job and we're giving you a fifty percent raise."
                "Uh, sir, uh, what's my cargo and where am I taking it?"
                The CEO smiled. "Women. You're to transport two hundred woman to Mars."
                "Women?" I asked, my brain still not working properly.
                "Whores, Knolls."
                Taking a couple hundred whores to Mars? Wow.
                "So, Knolls, are you taking the assignment?"
                What could I say? Of course, not ever having met any whores I had no idea how much of a pain in the ass it would be or that I would regret my decision. "Yes, sir, how could I not? Of course! When do I leave?"
                I wish my brain would have been working. God, what a mistake.

This is a crude, rough draft. Continues...

Mars, Ho!

Posted by mcgrew on Monday February 24 2014, @06:10PM (#90)
0 Comments
/dev/random

The book I'm working on now is the same name as the title of this journal. It was started at slashot, but will be finished here. I'll post it there, but the soyled get it first.

Except that it's already started and from what I can tell, none of the folks here at soylent know me. So for the next few days I'll be posting Martian whores here.

You had no idea what you were getting into, did you?

Neither did I.

What you will read is a crude, first draft. Stuff will be added to existing chapters, stuff will go away, and the order of some will most likely be changed. For an example, look at this finished, edited version of Nobots chapter 7 (which stands on its own as a story) compared to the draft.

I'll start posting chapters tomorrow. Wish Soylent had a "sci-fi" category...

Slashcott extended to end of month, but...

Posted by unitron on Monday February 24 2014, @03:29AM (#84)
0 Comments
News

The Slashcott is extended until the end of February.

(I thought about extending it through the end of March just so I could pop up the next day and say "April Fools! It's not over after all!", but that's just got too many moving parts)

This time, however, the extension is unofficial, which means you are free to break Slashcott and go over to /. and talk about how the Slashcott is still going on.

Just to mess with Dice's head.

Coming soon: The Paxil Diaries

Posted by mcgrew on Sunday February 23 2014, @03:47PM (#83)
2 Comments
News

This journal probably fits the other site better, since I don't think any of my old fans have come here yet, but I did say I'd post journals here first.

Ten years ago K5 was thriving, and my diaries got popular there. Folks wanted me to make a book out of them, and I promised I would.

I never got around to it, despite people periodically nagging me to. I finally did put together a PDF. I'd excised much of it, thinking it was too long, and emailed copies to those who asked.

Last Fall when I released the hardcover of Nobots I was again chided to get The Paxil Diaries on cellulose.

I'd discovered that no, it wasn't too long at all, and the abridged version was too short. So I redid the whole thing. I've been working on it almost exclusively for months and neglecting Mars, Ho! which I haven't done anything to since fall.

All that's left before publication is registering a copyright (it's half done in another tab), registering an ISBN (I have nine in reserve) and making a cover.

The cover is the sticking point. It's going to be a photo of downtown Springfield with Betty Boop photoshopped in, and I'm waiting for Springtime to take the photo.

So if anyone reading this has been urging me to release a physical book, I'm projecting sometime in April.

perl code doc project

Posted by crutchy on Sunday February 23 2014, @12:44PM (#82)
0 Comments
Code

work in progress

a minor difficulty i'm having with wrapping my head around slashcode is figuring out where functions are declared. i can use a search tool like sagasu, but i've done something similar to this for php so i thought it would be a fun perl project.

objective: parse code files in a directory tree and output page with linked index of files and functions

doc.pl

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
use strict;
use warnings;

##########################
sub doc__main {
    print "<!DOCTYPE HTML>\n";
    print "<html>\n";
    print "<head>\n";
    print "<title>Slashcode Doc</title>\n";
    print "<meta name=\"description\" content=\"\">\n";
    print "<meta name=\"keywords\" content=\"\">\n";
    print "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n";
    print "</head>\n";
    print "<body>\n";
    print "<p>blah</p>\n";
    print "</body>\n";
    print "</html>\n";
}

##########################
sub doc__functionTree {
    my($structure, $allDeclaredFunctions, $allFunctions, $allFiles) = @_;
}

##########################
sub doc__recurse {
    my($structure, $allDeclaredFunctions, $allFunctions, $allFiles, $allTreeItems, $caption, $type, $level, $id) = @_;
}

##########################
sub doc__aboutFile {
    my($structure, $allFunctions, $allFiles, $fileName) = @_;
}

##########################
sub doc__aboutFunction {
    my($structure, $allFunctions, $allFiles, $functionName) = @_;
}

##########################
sub doc__linkFile {
    my($allFiles, $fileName) = @_;
}

##########################
sub doc__linkFunction {
    my($allFunctions, $functionName) = @_;
}

##########################
sub doc__allFiles {
    my($structure) = @_;
}

##########################
sub doc__allFunctions {
    my($structure) = @_;
}

##########################
sub doc__declaredFunctions {
    my($structure) = @_;
}

##########################
sub doc__loadStructure {
}

##########################
sub doc__parseFile {
    my($structure, $fileName) = @_;
}

##########################
doc__main();
1;

Nobots: The whole book is now online!

Posted by mcgrew on Saturday February 22 2014, @01:35PM (#77)
3 Comments
News

Get it here!

So why did I move the release date up? Soylent! Or rather, a... uh, what do we call ourselves? Folks at K5 used to call themselves Kurobots, at slashdot they're slashdotters. What are we? Soylents? Anyway, a fellow here commented "Damn you! I went to see what your book was about and before I knew it I'm on chapter 7 and feel the urge to finish it tonight (otherwise I wont sleep). I've had plans for tonight..."

I'd just gotten my first check for books that had been sold the day before, but comments like that are even better than the check. I mean, I didn't write it to make money, I wrote it to be enjoyed. I walked around with a smile on my face all day and thought "gee, I need to let that poor fellow finish the book." So now you can!

If you're using FireFox to read it, PDF isn't the version to choose since FireFox sucks at rendering PDFs. It is, however, faithful to the printed version. Actually it was used to produce the printed version, and there may be some words in the HTML versions that should be italicized but aren't, I've found and fixed one or two but I'm sure I've missed some. Also, the PDF and printed versions are Gentium Book Basic while the HTML versions are Times New Roman. There is one passage that is Aral and renders funky in the HTML, and later in the book there's a Venusian nursery rhyme that is Comic Sans Serif in the printed and PDF versions.

I haven't posted the e-book version yet because I'm not satisfied with it.

If you select single file HTML (which you can download, of course) the screen will change only slightly, with links to PDF and e-book missing. Links to chapters are internal links.

I hope you folks enjoy it, that's why I wrote it.

Snowden Interview for German TV

Posted by drgibbon on Saturday February 22 2014, @10:25AM (#74)
7 Comments
News

No idea why this keeps getting rejected by Soylent eds, but anyway, there's a full 30-minute TV interview done with Snowden (in Russia) for German TV. 15 minute versions are floating around on the mainstream news outlets (except for from the broadcaster for Germans only), but you can see the interview on LiveLeak or the Internet Archive. Full transcript available from NPR.

perl

Posted by crutchy on Saturday February 22 2014, @07:24AM (#72)
1 Comment
Code

I'm a perl noob. Hopefully if I do some journal writing on my experience it will help keep me motivated.

Got some sort of perl server configuration going. Google not very helpful since most guides are for mod_perl pre 2.0 and apache foundation docs are jibberish to me (maybe I'm just stupid).

Anyway, here's a conf that I kinda butchered up based on a bunch of different sources:

<VirtualHost *:80>
  ServerName slash
  DocumentRoot /var/www/slash/
  Redirect 404 /favicon.ico
    <Directory />
        Order Deny,Allow
        Deny from all
        Options None
        AllowOverride None
    </Directory>
    <Directory /var/www/slash/>
        SetHandler perl-script
        PerlResponseHandler ModPerl::Registry
        PerlOptions +ParseHeaders
        Options +ExecCGI
        Order Allow,Deny
        Allow from all
    </Directory>
  LogLevel warn
  ErrorLog  /var/www/log/slash/error.log
  CustomLog /var/www/log/slash/access.log combined
</VirtualHost>

By the way, this is for Debian Squeeze.

My first hellow world script was also a bit more of an adventure than expected. Most tutorials leave out a header in examples.

/var/www/slash/test.pl

#!/usr/bin/perl
print "Content-Type: text/html\n\n";
use strict;
use warnings;
print "Hello world.\n";

I could (probably should) have used a text/plain mime header, but it worked nonetheless.
Also I can apparently use the following to add a path to @INC

use lib "/var/www/slash/Slash";

I downloaded the soylent/slashcode master branch from https://github.com/SoylentNews/slashcode/archive/master.zip so that I could have a squiz and see if I could be of any help with debugging etc, but although I can read some of it, I need to go to perl school before I can contribute.

My bread and butter programming languages are Delphi and PHP.

This explains a lot about the beginning of slashcode functions that aren't familiar to me:

http://stackoverflow.com/questions/17151441/perl-function-declaration
Perl does not have type signatures or formal parameters, unlike other languages like C:

// C code
int add(int, int);

int sum = add(1, 2);

int add(int x, int y) {
  return x + y;
}

Instead, the arguments are just passed as a flat list. Any type validation happens inside your code; you'll have to write this manually. You have to unpack the arglist into named variables yourself. And you don't usually predeclare your subroutines:
my $sum = add(1, 2);

sub add {
  my ($x, $y) = @_; # unpack arguments
  return $x + $y;
}

Is it possible to do pass by reference in Perl?
http://www.perlmonks.org/?node_id=6758

Subroutines:
http://perldoc.perl.org/perlsub.html