Author Archives: sinistar99

Phrase Maker

A tool for helping with song lyrics and creative writing projects / journals etc.

I love random generators:  This has been one of my favorite sites for years:

http://www.seventhsanctum.com/index-writ.php

You can create a random romance novel plot, or random dark-elf name or government conspiracy… or a few dozen other things.  It’s fun try it.  Here are some random story ideas it came up with just now:

In this story, a smooth witch-hunter falls in love with an impostor escpaing the past – all thanks to a repentance. What role will a studious tomb-robber play in their relationship?
In this story, a rascal who is from a parallel universe falls passionately in love with an energetic computer programmer – all thanks to a lecture.
In this story, a noisy dungeon delver is in love with a seasoned plumber. What role will a construction worker who had a near-death experience that changed them significantly play in their relationship?

This is yet another project I’ve been toying around with.  Back in the 90s somebody made a vb program that took your text input, and generated a response –like a chatbot, but with absolutely no pre-written response words or anything.  It was called “Talker.”  and I believe it’s the earliest incarnation of the kind of text generator that now does “My next status” on Facebook or “My Next Tweet” on Twitter based on your previous updates or tweets.

http://yes.thatcan.be/my/next/tweet/

All it does is take the words you put in and generates a random response based on the word order.   I’ve been searching for it for years, but the author and website disappeared and I can’t find the original.

Fortunately he explained it well enough at the time, that I was recently able to make my own… the algorithm is really simple.  It’s just like a random generator that picks from lists of things and puts them together. My kids had a talking story book toy that did this:

http://www.youtube.com/embed/We85BvXnF1E?

Take a random element from a list of nouns, a random element from a list of verbs, then objects and you have a much larger set of possibilities… thus from:

He saw the cat
She ate a pie
They sat on chairs

You can generate new sentences like He ate the cat, she ate chairs, They sat on a pie and so on.

What I’m working on does exactly the same thing –only instead of a set list of phrases… it uses all the lines or punctuated sentences you put in.

Now all your phrases won’t be in neet and tidy “subject verb object” format –but my program doesn’t care one bit.  It only cares where the words are, and what words likely come right after those words.

Take the phrases:

You can dance if you want to
You can leave your friends behind
Because your friends don’t dance
And if they don’t dance
Then they are no friends of mine
You can dance if you want to
If you don’t nobody will
You can act real rude and totally removed
I can act like an imbecile

It reads in each line marking the words as starting, ending, and the word after (if any) each word has.

STARTER WORDS

ENDING WORDS

You

to

You

behind

Because

dance

And

dance

Then

mine

You

to

If

will

You

removed

I

imbecile

The rules are simple:

Start with a random one of the starter words.
Find a random instance of the word after that.
Find a random instance of the word after that word.
Keep doing that until your next word happens to be an ending word.
Done

Let’s try it:

Find a starter word:

You  (let’s randomly pick the first “You”)

The word after that is “can.”  In this case, all the starter instances of “you” are followed by a “can” so if you start with “you” the next word is always going to be “can.”  But which “can?”

Find a random “can” in the sentences:

This can be either the “can” from “can dance”  or “can leave” or “can act” depending on which “can” we pick.  Let’s pick the one for “can leave,” so our next word is “leave.”

“Your” follows the only instance of “leave” so you’ll either end up with:

You can leave your friends behind

or

You can leave your friends of mine.

When you hit an Ending Word, you stop.

And those are the rules.

Other possibilities might be

Because your friends behind

Then they are no friends don’t dance

And you want to

and so on.   “And you want to“ might be a good next line or repeated refrain in that song.

What’s really funny is if you put that whole song minus “you can dance” it comes up with that line on its own.  Oooooh…

Okay now imagine you put every lyric by Nine Inch Nails in there and added  some code that said the next line had to rhyme with the last line.

Well I did.

I used a simple phoenitc dictionary and tagged each word with it’s phoenetic spelling and number of syllables…

It starts coming up with loose couplets like:

I don’t care what I’m supposed to.
My God sits in two.

And we’re living in my brain .
i should have to worry about no pain .

and I could have feeling.
I’m running .

I’m not picking the “best ones” either –those were the first 3 it came up with just now.  If it can’t find a rhyme after a while it gives up and says stuff like:

I feel you .
From dust .

How cool is that?

If you’re really stuck on song lyrics or poetry or whatever this can help.

But originally I didn’t write it for song lyrics.  I wrote it to be a “journal helper.” type thing.   So your journal can read more like a conversation and its response can help guide the next things you write about.  For creative writing in general.  For example I’ll put the text of this whole blog entry into it…

…and it responds:

Because your previous updates or

I take this as a question.  I could spend a few paragraphs answering it.  But I hit it again for another response:

I’ve been toying around with “you” the next word is always going to be “can.”

It sounds very positive and encouraging.. and at the same time a little creepy..  Heh….

Anyhow it’s not really supposed to generate original thoughts that make sense.  It’s a crude lever to help pry out whatever’s stopping your creative writing process.  Or a few words jumbled together in a way you might not have thought of to “prime the pump” of your own creative thought.

Besides rhyming, I can use the syllables to add rhythm.  I also added an option to use the 2nd words that come after words so instead of looking at just 2 word groups, it looks at 3 word groups –which is a common unit of english language construction.

This is good for dealing with prose –things with longer lines or sentences than song lyrics typically have.

Here’s an example.  I put in the entire text of Pride and Prejudice by Jane Austen –and set my program to “use 3 word groups.”

No I believe not before they are packed up .

It is really ill and keeps her room in earnest meditation; his brow contracted his air gloomy .

None of these sentences are in the book itself, but “his brow contracted, his air gloomy.” is a direct quote –which is the danger when being more strict with word order.  You drift toward repetition, but then as you loosen the reigns you drift toward senselessness.

If I turn off 3 word groups it falls apart and makes no sense at all.

But does Lydia should then we may gain some great neglect I was as I returned home the regiment after a point of all were all removed to the first quartered in her by dinner-time the whole of the corps she is .

Still it’s pretty cool for a random jumble of words.  “The whole of the corps she is…” and “quartered in her by dinner-time” are pretty cool phrases…  and not anywhere in the book.

I’m going to keep experimenting with this.   Maybe add a little bit of natural language processing –though that’s kind of what I’m trying to stay away from.  I don’t want it to “make sense” because then it’s less likely to make up things you wouldn’t have thought of.  It’s designed to break the rules… not follow them.

Here’s what happens when I turn on Rhyming with P&P:

Consent to every chance of opening her power .
Darcy was on Sunday night concerned in half an hour .

I was here as soon as your thanks .
Enough of making many weeks .

Now I cheated a little by taking only the last parts of the two lines it generated… but in doing so I just figured out how to make the syllables match!  Just arbitrarily cut off the first words until the lines match whatever you want them to syllable-wise!

Anyhow that’s one more project I started.

It Ain’t like Building a Brick Wall, Man.

Software projects aren’t like other projects.

Project managers still tend to look at creating a new piece of software as though it’s like building a brick wall.

Image

To build a brick wall.. you need x number of bricks, y amount of mortar, p number of people over t amount of time.

Image

If your project manager wants to know when the brick wall will be done given the current number of people, you can just count the bricks needed for the wall, figure how long it takes to lay a brick, and multiply.  Voila the brick wall will be done in 2 weeks ( or whatever).

If the project manager or stakeholders need it faster, fine –just hire more bricklayers.

But a software project isn’t like building a brick wall.  It’s more like inventing the lightbulb.  It’s a totally different question –and there’s no equation for it, just a lot of rough guesses that are obsolete by the next project.

Image

“Da f#%$ you mean “when can we demo the light bulb?”

When the manager asks:  “When’s the light bulb going to be invented?” the conversation goes something like:

Manager:  “When can we demo that light bulb”

Developer: “Well we tried a couple of different fibers for the inside and they burned out.  Bob says we should try tungsten so we have some ordered… It should get here next week…”

Manager: “So can we demo the light bulb next week?”

Developer: “No.  Maybe.  We don’t know if Bob’s right until we try it.  Also we’re trying to increase the pressure on the vacuum to keep it from oxidizing and adjust the voltage…”

Manager: “So when can we demo the light bulb?”

Developer: “um…   4 weeks.”

This is a complete lie. No one has any idea when or even if it will work. Ever.  And if it does work we don’t know if it will be compatible with the new electrical power grid coming out or if this is the best way to do it at all.

4633000725_50e63a59df_o

 

Manager puts the date in MS project and moves to the next question:

Manager:  “So if we hire more inventors, can you get the light bulb invented in 2 weeks?”

“They’ll be some time getting the new people up to speed on the project. “

“So what?  3 weeks?”

“Uh… yeah…Sure…”

Image

“da f$% did he mean, “when can we demo the light bulb?”

VB.NET to C#

I’ve read some articles about why people prefer VB.NET over C#. Being “married” to any language is silly  –and in this line of work fatal.  Learn half a dozen languages well. The concepts are the same whatever you’re using.

The biggest mistake people make when going from one language to another is not taking advantage of the differences.  Going from C++ to Python for example, you have to realize you can let Python do a lot of the work.

But about VB.NET vs C#

Functionally they’re the same… pretty much.  Re-reading this I don’t get into what might be more legitimate gripes like “Dude, where’s my REDIM?”  –and the answer is if you’re lamenting lack of redim or Redim Preserve, then you should really start learning about different types of data structures other than the array.

Coming from a VB.NET background I was forced to learn C# because of my job.  I had all the same misgivings that any VB person has going into c#… oh the dreaded semicolon… oh no it looks weird it’s harder to tell what it’s doing…etc

Once I did learn c#, coded in it a lot and started thinking in c#, I can tell you first hand I have NO desire to go back.  None.

Here’s why:

Sure I have to put a semicolon at the end of every command (which gives me complete, explicit control of my code layout –great for lining up sql commands, long lists of parameters and so on)  BUT I never ever have to type DIM…AS, THEN, NEXT, LOOP ENDIF ENDWHILE ENDSELECT, TO, STEP, (and more) ever ever again.

 

Just look at the IF statement in VB.NET:

 

IF X=1 THEN

doSomething()

doSomethingElse()

ENDIF

 

Sure maybe it looks more intuitive to the non-programmer than:

 

If(X==1)

{

doSomething();

doSomethingElse();

}

But I’m not a non-programmer am I?  If you’re a non-programmer,why would you care anyhow? With C# I use fewer words and less characters –and it looks just fine to me now that I’m used to the language –so why would I want to go back to typing all those useless words? THEN, ENDIF… blah.  The only word that matters there is IF.  IF tells you 100% of everything you need to know about when or not to execute the command block that follows it.

 

Even in English you can say, If you want some ice cream, open the freezer and get some ice cream.  No one is going to wonder what you mean if you don’t say, “then,” so why should the computer?

 

But brevity is not the only advantage to c# syntax.  What if, in the above example, I found out later X was always going to be one… or it didn’t matter, and I wanted to get rid of the If and just call the two methods?

In c# I can just take away the IF(X==1) line.  Done.

 

I don’t have to go hunt down the Endif –which may be deeply nested and 100 lines ahead.

 

Same with English.  If I can assume you want ice cream or don’t care whether you want it or not, I can just omit the IF clause.  Open the freezer and get some ice cream.  Just like with C#.

 

What if I wanted to change the IF to a FOR loop and do it 5 times?  I’d have to again go find the ENDIF and change it to a NEXT and change the IF to FOR , add a TO (and possibly STEP as well).  In c# I can just change the IF to a FOR and add some parameters. Since the closing statement for ALL code blocks (IF-THEN, FOR-NEXT, DO-WHILE, etc) is the same, you never have to worry about changing them.  You only have to change the part that matters.

 

Let’s talk about FOR:

 

We use it all the time.

 

VB

Dim i as int

FOR i = 10 to 1 STEP -1

DoSomething(i)

NEXT i

 

C#

 

For(int i=10;i>=1;i–)

DoSomething(i);

 

BAM!

 

Maybe as a VB.NET programmer, the latter doesn’t look intuitive to you, but honestly it would take you what, an hour at most to learn it and a couple of times using it to get used to it?

 

That’s a small price to pay for eternal freedom from the shackles of DIM, NEXT, TO and STEP… and making a ridiculous block of code out of something that’s really one verb (DoSomething) and a modifier (FOR this many times) in terms of natural language.

 

Maybe you’re thinking …But I like NEXT, TO, and STEP (and ENDIF and so on)

 

No –if I may be so presumptuous as to guess your true feelings– you don’t.  Chances are you’re just used to them.  You can get un-used to them just as easily and I promise you you will never ever go back unless you absolutely have to.

 

To me, that’s the real test.  Use both for a while and see which one you will use voluntarily if you’re writing your own little application at home.

 

Another very practical reason C# is better than VB is this:

 

Here’s our lovely For loop code in C#

 

For(int i=10;i>=1;i–)

{

DoSomething(i);

}

 

Here it is after a painstaking translation into Java:

 

For(int i=10;i>=1;i–)

{

DoSomething(i);

}

 

And by “painstaking translation” I mean “cut and paste, because it’s exactly the same!  If you learn C#, you get the vastly greater share of Java along with it.  It’s like a 2-for-one. There are some important differences, but most of the syntax, data structures and design patterns you learn in C# will work nicely in Java, and if you see some java code, chances are you can paste it right into c# and run with it.

 

But so far I’ve only given superficial reasons why I think c# is better, the reasons go deeper.

 

It has been said that the mother of computer programming is Lord Byron’s daughter, Ada Lovelace, who explored the combination of poetry and mathematics and created instructions for solving mathematical problems based on poetic structure.  Computer programming and poetry have in common the fact that structure is very important.

 

In poetry, every syllable matters. The rhythm, the layout, all of it is part of what is being said in the poem.

 

If we see the phrase:

 

I am dying to meet you.

 

…laid out like this:

 

I am dying

to meet

you.

 

We come away with a very different feeling about the meaning of the phrase.

 

Let’s take a look at the For example again:

 

VB

FOR i = 10 to 1 STEP -1

DoSomething(i)

NEXT i

 

C#

 

For(i=10;i>=1;i–)

{

DoSomething(i);

}

 

Notice how much more the For and the DoSomething stand out -uncluttered by the formalities of ending block statements.  C# gets right to the important stuff and leaves out the stuff that doesn’t matter.

 

To me this is more poetic and, if anything, less formal.

 

It’s really just Verb / modifier.  A very natural way of expressing an instruction.  Do this 10 times.

 

The NEXT or ENDIF or other block ending keywords in VB remind me of the formal military way a recruit is required to speak to his drill sergeant:  Sir, Do this 10 times, Sir!  Or the formal way you would have to speak on a radio transmitter.  Coder to Computer: Do this ten times, Coder out.

 

In this way, if anything, c# is a more intuitive, more natural way of communicating.

The whole selling point of VB is that it’s supposed to more like plain English –But, really, when was the last time you heard someone say, “EndIf?”  In VB you’re talking more like a robot.

 

This is not to say that a language is bad because it has end-block statements.  For example Fortran has EndIF, Delphi has EndIF… Perfectly respectable languages have EndIF.  Even the beyond reproach, codier-than-thou C++ (blessed be its holy name) is not above employing  #IF / #Endif when making conditional compile directives in some environments.

 

No one looks down her nose and says anything along the lines, I am more computer-smartiepantsier than you because you use Fortran 90.

 

And I won’t if you use VB  -I used it for a long time.  I just don’t like it as much as c#.

 

It’s just my job 5 days a week

I was a software developer.  I developed a lot of this program:

http://www.clearcreeksolutions.com/SearchResults.asp?Cat=66

See that interface… I made that. I drew those pictures, I developed that map interface based on ESRI’s now obsolete MapObjects LT. I drew all the icons and buttons, and wired the events tied to them.  That grid that connects a “cloud raining” box to a “pond” box… That was my idea.  I wrote the code to do that.  I made that little pond picture using Paint Shop Pro.   

In order to do a continuous simulation hydrology model you would use a Fortran program called HSPF which was developed by the USGS with a company called Aqua Terra Consultants.    It was complex to use –you had to write “input files” in a cryptic and exacting format to show your land use, ponds, outlet structures, soil types, and everything that went into a rainfall simulation. It was not an easy process and there was a lot of room for error.

I got my first real programming job with Aqua Terra in 1999.   They hired me because they had a project with the Washington State Dept of Ecology to make a graphical user interface to let regular engineers and city and state reviewers do continuous simulation hydrology models without being HSPF experts.

For a hint about why there would be a need for this, please refer to the 700 page manual for HSPF.

http://books.google.com/books?id=cdXuAAAAMAAJ&pg=PA677&lpg=PA677&dq=Hspf+input+file&source=bl&ots=o0xJTXqdPG&sig=NVleGoYZ67I0VLpKT0vorT4NvBY&hl=en&sa=X&ei=k9KYUoSkEdjcoAS47ILIBQ&ved=0CEcQ6AEwAzgK#v=onepage&q=Hspf%20input%20file&f=false

Or read the manual for the WWHM

http://www.ecy.wa.gov/programs/wq/stormwater/wwhmtraining/wwhm/wwhm_v3/manuals/WWHM3_User_Manual.pdf

…Only 95 pages… and a lot of those pages are filled with nice pretty pictures.

Anyhow that’s what I did a lot of when I was in my 30s.

I wrote a great deal of versions 1 to 4 of that program.  It was a long project and I got to code almost every day.

Now I’m lucky if I get to code EVER.  My day is filled with meetings, documentation, testing, GIS analysis (and very little of that), software support, and more documentation and more meetings.

Most of the actual coding is done by contractors whom I envy to the core.

I can’t complain because it’s a great job.  I just miss coding!  I miss creating things.  That’s why I got into this business in the first place.  So I could program.

Anyhow my point is, I’m stuck doing all the things AROUND coding.  Documentation… meetings… requirements… more meetings… training material… testing… support… repeat.

Administrative things.. meta-coding.  It’s like if we do enough of the stuff AROUND the actual tools we’re trying to create… the tools will create themselves.

…But they don’t.

 

Make it Public Project (or some better name I can’t think of right now)

copyright_chains

Can you move copyrighted material into the public domain?

There is a non-profit organization in Washington and other areas whose goal it is to buy undeveloped land and make it public land to preserve it’s integrity.

This is called the Trust for Public Land and more information can be found at http://www.tpl.org/

It gave me an idea.

Why not something similar for intellectual property.

How much media, music, movies, software code, books, and various forms of information are just sitting there collecting metaphorical dust fenced off by existing copyright protection which could be opened up to the public creating opportunities for study, derivative works and enjoyment?

The first task is to find out what’s already out there. There are numerous places on the internet to find copyright free work.

One of my favorites is the Internet Archive http://archive.org/details/movies

This site is a treasure trove of movies, radio shows, music and so on which are in the public domain. If you wanted, for example to take the 1936 movie “Dancing Pirate.” ( http://archive.org/details/cco_DancingPirate )
and make your own iPhone app dancing game using images and sounds from the film, you could do so without worrying about violating the intellectual property rights of the film makers.

Dancing Pirate

You could even use dubstep music from (for example) “Danny Dj AKA Dannytrance” for the songs, creating an original work of your own by putting together these far-removed sources.

http://ia701200.us.archive.org/32/items/DubStepVol.1/DubStepDannytranceInSession.ogg

Another source for movies in the public domain is Open Flix.  http://www.openflix.com/genre/sci-fi~&~fantasy.html

There are also many sources of books that are in the public domain from which new creators can find inspiration, knowledge and the opportunity to create new works based on new ways of looking at this information.  Project Gutenberg is just one example:  http://www.gutenberg.org/

So far what I have found are efforts to catalogue and make available public domain works –which is in itself a very worthy endeavor, but I think it should be taken a step farther and someone should start a project that takes an active role in adding more to the list of material available in the public domain.

I’ll keep looking into this, let me know if there is anything you can think of.

These all deal with things that are IN the public domain already.  The question I have is the next task:

How do you take something that’s copyrighted and move it to the public domain?

Here is some useful information about existing copyright laws:
http://www.publicdomainsherpa.com/copyright-expiration.html

And here is some more (mainly pertaining to music)

http://copyright.musiclibraryassoc.org/Resources/FAQ

Here’s a place to search for whether something has an existing copyright http://www.copyright.gov/forms/search_estimate.html

…but it will cost you.

Update 8-12-2013
http://creativecommons.org/about/cc0

Creative Commons. org has a legal mechanism for placing work you own in what they call the CC0 domain.   Basically it’s an easy way to open your work to the public for use, releasing all your rights to it and giving it to the public.  It’s like public domain, but a little different.  So far it seems perfect for what I think any “make it public” type of project should be trying to do.