Sunday, March 29, 2020

Watching Covid-19 cases

This last week I had started watching the count of cases for my county, Middlesex in Massachusetts, hoping to see things leveling off soon. (I'm looking at this site: Coronavirus COVID-19 (2019-nCoV). It seems legit.) Unfortunately the numbers are still climbing. When I started they were below 200. Today I see the number of active cases is 837. Yesterday the active count was in the 500's. According to the site there are no recoveries yet, which is I assume because all the cases are less than a couple weeks old and it takes at least that long for the disease to play out.

While the schools and almost all businesses have closed their locations, I still see kids playing at the playgrounds when I walk my dog. Just a few, but I wish people wouldn't do that. Still, better than New York City, which looks like it's going to be disaster.

Anyway, I short update. I'm still working at my job, thanks to telecommuting. I'm going to try to keep updating during this special period.


Thursday, September 5, 2019

Story: Future Sacrifices

Wrote this story idea down in my journal back in January. I want to write this story before the idea fades completely.

From my journal:
Thursday, January 17th, 2019
Got an idea for a story this afternoon, which I'll record here.
Future Sacrifices
A visitor from the future visits a Democratic Party think tank, imploring them to take certain actions in order to avoid future catastrophe.
He says a huge government project has sent him to the past - using the entire nations power output for 3 days - sending him back as far as possible.
After 15 minutes the visitor disappears, as the future has changed too much and he no longer exists as this verison.
The visitor says the cost of fighting climate change has impovished the country.
After the visitor  leaves the members of the think tank apply themselves and using the visitor's guidance get some things passed.
Then the visitor comes again. His description of the future is worse! Also his appearance is also worse. He says he was sent as far into the past as the future could afford (generate?).
- Each time the visitor appears, his description of the country/world is worse and he looks worse off himself. (By his last visit he's actually hard to look at. Painful body modifications)
- the visitor's guidance becomes continually more unethical. Lying, bribery, blackmail, assignation
- the membership of the think tank gets smaller and more fervent as moderates leave.
- the opposition reacts to the actions of the tank, resistance, matching attacks
- include target politician?
- include inventor of "high torque Stirling engine"?
-- reacting to the environment - economic, political
-- goes from barely started, monopoly fighting, jailed, political sponsor, to giving his fortune away
process repeats a many times until the present reaches the time when the visitor said he came from.
Despite of all of the tanks actions things have not gone the way they wanted.
(The last time the visitor came, he suggested assignations, but the members are caught)
The Democrats we lost and now an invigorated Libertarian Party is the best challenger to the Republications.
The tankettes can never understand why their actions seem to be making things worse - need an ironic statement of the truth, like "censoring those who don't agree with climate change makes the climate worse". Hint at the obtuseness of the tankettes.
While the people of the present remember the visitor, it's always the first time for the visitor. The future is changeable, just not in expected ways.
When the tankettes ask about their place in history, they are always in for a disappointment, no matter what they do.
- dispirited, the inventor sells his patent to a Chinese company.
- in the end the inventor sees no great need to invest in politics and does startups and charity instead.
The remaining not convicted tankettes look up the visitor, find he's a stoner, with friends in high-energy physics who have moved on.
End with the Republican party happy to have such opponents.

Need to create character in the think tank who we'll write the story around.

Kentucky Bourbon Barrel Ale

Had one these with my hot wings tonight. The bourbon taste is very distinctive and delicious, in small doses. I would drink this beer all night, but when I have time to reflect and enjoy, it shines.

Brewer's webpage here.

Story Idea: Twilight Exit

Normally my story ideas start and grow to book length, but this story seems to be a natural short story. This came to me as I watched twilight come on next to our new pool.

A father and son arrive at a vacation home in the woods. They settle by the pool as the sun begins to set. The son is wearing headphones and the father monologues about the changes in the natural world as the sun sets. The father talks about a "switch" where the day changes to twilight. He describes it as a hiccup, where everything changes from one state to another. That in that time, there's seems to be an opening where things are open, undecided, before setting down again. From the father's monologue the reader understands that he has regrets about his son, his family, and his life. The father describes how the bats will come out later, after the sun has set for awhile. The monologue ends and the son finally notices that the father is no longer around.

Outline
Father & son arrive, settle around the pool.
Father starts the monologue. He's addressing the son, but the son has headphones in and never responds.
The home has been in the family a long time. The father says he has always felt a special connection to the sunset. He has spent many days through the years, watching the sun set by this pool.
notices a eagle returning to it's nest
smaller birds venture out more as the king has left the sky
closer to the pool the dragon fly come out, darting in various directions.
reminds him of the "invisible feeding frenzy" where dragon flies and sparrows would take turns feeding on a swarm of tiny white flies. The predators would take turns attacking the swarm. Not sure why the sparrows avoided eating the dragon flies, but they did. He tried to take pictures, but his phone could only capture blurry pictures of the birds and dragons. The white flies of the swarm where hard to see with the naked eye and invisible to his phone's camera.
How does the dynatrap work?... the father's theory that the trap works by attracting moths, that attract bats, that eat the mosquitoes when the are in the area. Mentions the bats will show up a fair amount of time after the sun has set.
The father mentions the setting sun touching just the tops of the trees. Soon there will be what he feels like a pause between the day and evening. Not between day and night, as the twilight has a unique process to itself, but between the day and the twilight. The pause seems endless even though if you try to measure it, it disappears. Nothing happens, and yet it seems like an invitation, a path through the woods you notice for the first time, but it was always there.
The son's phone loses power and he notices the father is no longer near by. He calls out with no response, but the car is still in the driveway. The son goes into the home to find power for his phone.

This story is a bit of downer.

Friday, July 19, 2019

Story to write: Undead Love

(I'll be posting my story ideas here to record how they develop.)

I've been thinking of this story recently and I want to write it down before I lose the details.

Plot: in a fantasy world, a ship runs aground off the coast of a strange continent. The protagonist finds himself separated from the rest of the ship's passengers. The land is in turmoil as humans and the undead battle constantly. The humans seem especially cruel to the undead they capture. Meanwhile an undead hermit seems to be a kindred soul. The p disguises himself and approaches the hermit. The hermit is not fooled by the disguise and surspiciouly slips p a potion that will cause him to "love" the undead. P does chores to build trust with Que. Que is thinking it isn't needed and that p is under get control.
P learns the lands language, share by both sides of the conflict. Que has finished a project for the queen. They make plans to travel to the capital. But as p is gathering firewood, adventurers kill Que. P returns to find Que dead and tracks down the murderers. He kills 3 as they wait for their victims to come. The 4th he chases into a crowded town square. He's disguised again, not realizing the undead can see through it. Explains to the constable who the man is and asks what is to be done with him. The increased townsfolk are a bit dumbfounded, but tell him to bring the heads of the attackers and the body of Que to the capital.

Hmm.. This seems to be a longer story. Summarizing, P travels to the capital and meets the queen of the undead. The body of Que is used to create a new undead, with the memories of Que, but still a new person, Rou. Rou leaves. P is a curiosity in the undead capital. There's the remains of the former population of the lands in cages. Also the other passengers from the sick ship. He convinces the queen to release his fellow countrymen. The queen has P remove his disguise. P tries to help a cage with a little girl, Calexis. This backfires. P fosters Calexis, telling her he will find a proper family for her. The queen returns from her trip. He tells Calexis he will protect her, no matter what. The queen demands his presence. She says the girl must go back into the cage. P quickly ascents, to everyone's surprise. He carries her to the cage. He asks the jailers to open the door. The jailers says Calexis can fit between the bars, but P says "she can but I can't". A murmur erupts from the crowd. P and C enter the cage, and soon the queen appears. Before she can speak, P says "I'm sorry to see you behind bars, S". The queen gives him a doubtful look as P continues. "Why do I love your people?", he asks rhetorically. He explains that the undead are people, different, but still people. But so are people in these cages. While they have lost their homes they are still people and now that the war is over or time to release them. The Queen holds up her finger for silence and ponders. Using a spell she determines that the potion has no effect on P. She agrees to release the prisoners. The shipmates will guide them to the southern human kingdom.
P meets the king, things go badly.
P escapes the dungeon.
P recovers C.
P and half of the shipmates back in the undead capital.
In little bit Ps countrymen stage a rescue, not realizing the situation.
P stands i front of queen to protect her from the Swat team. He takes off his helmet hoping to stop the attack, but a bolt is already on it's way. P is struck down and dies. C wails. The queen sacrifices herself to bring P back. P wakes up on the boat leaving this land.

Friday, July 14, 2017

Nasty problem using String.replaceAll and String.replaceFirst

A customer ran into a problem using my code yesterday. My code does a bunch of SQL stuff and years ago I started using tokens and the replace methods to make things more readable.
Instead of:

String query = "select value from synonymtable where domainid='" + domainid.toUpperCase() + "' and internalvalue='" + internalvalue.toUpperCase() + "' and defaults = 1" ;

I had:

String query = "select value from synonymtable where domainid='<domainid>' and internalvalue='<internalvalue>' and defaults = 1"
.replaceAll("<domainid>", domainid.toUpperCase())
.replaceAll("<internalvalue>", internalvalue.toUpperCase()) ;

Using the replacement methods made the code much clearer. And I could create a template string.

static final String queryTemplate = "select value from synonymtable where domainid='<domainid>' and internalvalue='<internalvalue>' and defaults = 1" ;

The problem comes in because these replace methods take regular expressions, but I thought I'm fine since I'm always just doing straight replacements. Unfortunately the client had added a column with a $ to their database. Something like COST$.  In a regular expression the dollar sign ($) means something, so this breaks a bunch of code.

Caused by: Illegal group reference
at java.util.regex.Matcher(Matcher.java: 819)
at java.util.regex.Matcher(Matcher.java: 917)
at java.lang.String(String.java: 1718)

And I have 400 over places where I'm using the replace methods. Arrgh!

I've created a utility method to work around this.
public static String replaceAll(String template, String ... tokenValuePairs)
{
    if (tokenValuePairs.length % 2 != 0)
    {
        throw new RuntimeException("Method expects pairs of tokens and replacement values") ;
    }
   
    String ret = template ;
   
    for (int x = 0; x < tokenValuePairs.length; x = x + 2)
    {
        ret = ret.replaceAll(tokenValuePairs[x], Matcher.quoteReplacement(tokenValuePairs[x+1])) ;
    }
   
    return ret ;
}

The Matcher#quoteReplacement formats replacement string so I don't need to escape any characters.
Now the code will look like:

String query = StringUtility.replaceAll("select value from synonymtable where domainid='' and internalvalue='' and defaults = 1",
    "", domainid.toUpperCase(),
    "", internalvalue.toUpperCase()) ;


Unfortunately I need to fix probably hundreds of places where the replace methods are used.

Friday, April 29, 2016

Great Quote in Althouse Comments

Dave in Tucson said...
> Ted Cruz's rebellion against Congress's leadership is like Satan's rebellion against God Almighty

You're comparing Republican Congressional leadership to God Almighty? Facts very much not in evidence.

It really is astonishing to me that when the other choices are the Commie, the Crook, or the Clown, high level Republicans are saying stuff like this about the one choice that might not be a complete disaster for our country.