April 25th Reading at Two Hour Transport

I’m excited to announce I will be a guest reader at this month’s Two Hour Transport! Next Wednesday, April 25. Come on out to Cafe Racer to hear the open mic readers at 7:00, and the invited guest readers (me and G.G. Silverman) at 8:00.

 

twohourtransport

Join us for two hours of science fiction and fantasy reading at Cafe Racer on Wednesday, April 25th.

Signup starts at 6:30
Five minute readings from signup 7:00 – 7:50
Invited readers 8:00 – 9:00

Bios

G.G.’s work has appeared in Corvid Queen, Evil Girlfriend Media’s EGM Shorts, Fantasia Divinity’s Goddesses of the Sea anthology, Pop Seagull’s Robotica anthology, Molotov Cocktail, Iconoclast, the Iron Horse Literary Review, and more. Her flash fiction has recently been nominated for the Best Small Fictions anthology, and she’s currently at work on a short story collection as well as her third young adult novel. In her free time, she’s an improv performer, and enjoys making people spit out their drinks.

What happens when you sit down to write? Sometimes, magic. Magic created that first biography, of Harriet Tubman, and transported the six-year-old Ramona Ridgewell into the cotton fields, toiling from dawn to…

View original post 68 more words

Advertisements
Posted in Uncategorized | Leave a comment

Kano

Yesterday, on a bright day in early spring, I let Kano—my little ray of sunshine—go. I was ready last Friday, but the vet was hesitant, so I waited. Kano was probably ready a month ago, after his last major event—which was probably a stroke.

Kano4

The past four weeks have been a whirlwind of cleaning poop from Kano’s behind, cleaning his bedding, cleaning the floor in his room, following him after his many trips to the litter box to make sure his rear was clear, drugs, drugs and more drugs. There were numerous trips to the vet. The only issue with them was that my vet of choice—who Kano had been with since he was a kitten—is now semi-retired, so is in the office only on Wednesday, Thursday and Friday. I tried to time our visits around that, but it didn’t always work out.

To reduce Kano’s stress—as well as reduce my cost—the vet taught me to give intramuscular and subcutaneous injections, and to administer a subcutaneous fluid drip. The final week, Kano got fluids every night.Kano’s major problem was arthritis. It progressively worsened over the last two winters. The worse it got, the less time he spent up and about. The less he moved, the worse it got. When you explain these things to cats, they only watch your lips move and purr. He also had chronic kidney issues and developed a heart murmur. Murmurs are purrs without the rumbling.

Combined2

I don’t regret any of my actions—regret is such a bad state of mind. If I were to do it again with prior knowledge, I would have ended it last Friday, if not right after Kano’s stroke last month. I could see the signs. Beyond spending nearly all of his time sleeping, Kano quit eating. That might have come because he could not stand well enough to brace while defecating. He would strain, then his back legs—where his arthritis was the worst—collapsed and he would struggle to get back on his feet. He just gave up and walked away. Then, he would be back in the box a few minutes later to try again. I definitely would call it off before the day of enemas at the vet (last Saturday), but I didn’t.

My husband, Shinko, went through some similar things near the end of his life. I am thankful he tried to hard to stay with me, but the last week, he could no longer make decisions for himself. I was glad, after a couple of hospital stays a few months earlier, that he asked me not to send him to hospice. He was home, where he belonged. I did my best. That final week started with what I believe was a stroke. He was unstable on his feet and confused. He became like a child, willing to do what I asked. For him, if I could have made a choice, I would have let him go Saturday morning, when he lay down for the last time and quickly became catatonic, then rigid, then cold—except for his torso, his cheeks and the palm of his hand, which I frequently held. He was done. I knew it, and felt helpless to help him. I actually had the means—hospice gave me morphine at some point. I was afraid, so I followed all the rules. I won’t make that mistake again.

Combined1

After I got home from the vet, with only Kake—my other cat, who went with me even if he didn’t understand what was going on—I began cleaning up. It gave me something to do besides cry. I gathered all the soiled bedding to wash. I collected all the boxes-cum-steps that led to the window seats for the past half year. I removed the litter box from the powder room next to the kitchen—it will be nice to contain the litter to Kake’s upstairs bedroom again. It was a beautiful spring day in Seattle, so I opened all the windows. It’s a good thing to do when someone passes—and light a little incense. And sing.

Last evening, I received a surprise box from my friend, Carla. I didn’t even hear her sneak up the front steps and leave the gift. I was on the phone with my Mom—the only person I talked to last night—when I got a text that said, “Look on your front porch.” The box was filled with silly little items, and with love. I laughed. I immediately set up the tiny Zen garden, complete with sand, meditation chimes and incense. It was perfect.

Combined3

Going to bed—which had become a long, involved process of giving pills and fluids to Kano—was as simple as saying, “Kake, let’s go to bed.” This morning was equally disorienting.

Now, I feel sadness and calm.

I am filled with gratitude for all of my friends and family for their support during the loss of Kano. A special thank you to Dr Rowse, Maddie, and everyone else at Ballard Animal Hospital.

Copyright ©2014-18 Ramona Ridgewell. All rights reserved.

Posted in #Death, AmWriting, Cats, family, Life, Pets, Writing | Tagged , , , , , | 1 Comment

Moving Forward with My Novel

I am ecstatic. I finished the outline of “Tishta the Crystal Orb” today.

via Tishta the Crystal Orb: Outline Finished — thewolfdreambooks

Posted in Uncategorized | Leave a comment

Happy New Year!

May you find love, good health, tolerance and compassion in the coming year.

Happy New Year!

Posted in Uncategorized | Leave a comment

Retrieving Notes from iBook and Kindle

In my work as a fledgling author, I have reached the point of soliciting feedback from Beta Readers for my first novel, “Tishta the Crystal Orb.” It is the first in a series of fantasy novels—there will likely be five—and my first try at anything as large as this. It has been a fun adventure.

Today, I figured out how to retrieve Notes from iBook and Kindle. It was not a simple process and I still do not have methods for all platforms.

For iBooks, it was relatively painless on an iPhone, but not so much on a Mac (although, I did find one hacky way to do it). I wrote a blog post, in case anyone is interested.

On Kindle, it was just the opposite—relatively easy on the Mac, but not really possible on the iPhone, that I have been able to discover. I blogged about this, as well.

One reason for this post is to share what I learned.

The other is to ask, has anyone else figured out how to do this? Even with the methods I found and wrote about, it is going to be a big chore to match up the comments with the text. I am hoping to discover how to do this by the time my readers begin sending me their feedback. It would be nice if both of these formats did something similar to what can be done with .docx files.

Copyright ©2014-17 Ramona Ridgewell. All rights reserved.

Posted in #Education, AmWriting, AmWritingFantasy, Books, Education, Fantasy, Life, Novel, Reading, Tishta, Writing | Tagged , , , , , | Leave a comment

Python and unittest

In this blog post, I will show how to create unit tests to go with some python code using unittest. The project will implement a simple stack using an array—or, more properly, a list.

Create a Project

Start by adding and navigating to your project folder, e.g., exercises. Initialize it with git so you can checkin your changes.

mkdir exercises
cd exercises
git init

Open project folder in your IDE.

Create a file, __init__.py, in exercises. Leave it empty. Save and close it.

Add a folder, src, in the project folder, exercises.
Create a file, __init__.py, in src. Leave it empty. Save and close it.
Create a file, stacks.py. Leave this empty, for now.

Add a folder, tests, in the project folder.
Create an init file, __init__.py.
Add this code:

import sys, os

myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../src/')

Create a test file, test_stacks.py, and add this code:

import unittest

from stacks import Stack

class StackTestCase(unittest.TestCase):
    def test_is_empty_true(self):
        test_obj = Stack()
        self.assertEqual(True, test_obj.is_empty())

if __name__ == '__main__':
    unittest.main()

Run The Test

python -m unittest discover

This will generate the following:

E
======================================================================
ERROR: tests.test_stacks (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: tests.test_stacks
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 254, in _find_tests
    module = self._get_module_from_name(name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
    __import__(name)
  File "/Users/your_name/src/Closet/exercises/tests/test_stacks.py", line 3, in <module>
    from stacks import Stack
ImportError: No module named stacks

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

Of course, it fails. stacks does not exist. We have not yet coded it. I wrote the test first to show how extreme you can go with TDD (Test Driven Development). The advantage here is that you expect this type of failure, and you really test each and every step along the way. The first thing to do to get rid of this error is to create the class, Stack.

Add this to ./src/stacks.py:

class Stack(object):
    """docstring for Stack"""
    def __init__(self):
        super(Stack, self).__init__()

Run the test again:

python -m unittest discover

This time, the error is a little different:

E
======================================================================
ERROR: test_is_empty_true (tests.test_stacks.StackTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/your_name/src/Closet/exercises/tests/test_stacks.py", line 8, in test_is_empty_true
    self.assertEqual(True, test_obj.is_empty())
AttributeError: 'Stack' object has no attribute 'is_empty'

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

Again, a very expected error. Add the method, is_empty() to fix it.

    def is_empty(self):
        return self.stack == []

Run the test and see it work:

.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

Notice the E at the beginning has changed to a dot. A dot indicates a successful test. Also, FAILED (errors=1) has become OK.

Add A Second Test

We are missing a test. We should test for is_empty() is False. By adding this test, we will be forced to implement push() to make it pass.
Here’s the test:

    def test_is_empty_false(self):
        test_obj = Stack()
        test_obj.push('data')
        self.assertEqual(False, test_obj.is_empty())

Here’s the failure:

E.
======================================================================
ERROR: test_is_empty_false (tests.test_stacks.StackTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ramonaridgewell/src/Closet/Udemy Python Algorithms/exercises/tests/test_stacks.py", line 12, in test_is_empty_false
    test_obj.push('data')
AttributeError: 'Stack' object has no attribute 'push'

----------------------------------------------------------------------
Ran 2 tests in 0.000s

FAILED (errors=1)

Here’s the code to fix it:

    def push(self, data):
        self.stack.append(data)

As expected, the tests both now pass:

..
----------------------------------------------------------------------
Ran 2 tests in 0.000s

OK

This is probably a good spot to check in the code. Add a new file, .gitignore in the project directory. Add this:

.DS_Store
*.pyc

This code will tell git to ignore the Desktop Services Store and all the python compiled source files—there is no reason to check these in. Since folders are being committed on this checkin, you can’t see the files with their extensions. Run:

git add .

Then run:

git st

before the checkin to ensure only the files you want to check in are listed. When you are satisfied, run:

git commit -m "initial checkin - added is_empty() and push() to new Stack class"

I’m not going to explain creating a github repo here. If you need to know how to do that, check out this blog post for instructions.

What Comes Next?

Now is a good time to think about what other tests you can add to ensure the current codebase is correct. With only push() and is_empty(), there aren’t many interesting things we can test. We could push on a second item, but we can’t really test anything except that is_empty() is still True. I think adding tests around pop() would be a more interesting and efficient use of our time. Let’s write a test.

    def test_pop_handles_empty_stack(self):
        test_obj = Stack()
        self.assertEqual(None, test_obj.pop())
        self.assertEqual(True, test_obj.is_empty())

I started with this code:

    def pop(self):
        data = self.stack[-1]
        del self.stack[-1]
        return data

but it failed with:

Traceback (most recent call last):
  File "/Users/ramonaridgewell/src/Closet/Udemy Python Algorithms/exercises/tests/test_stacks.py", line 17, in test_pop_removes_item_from_stack
    self.assertEqual(None, test_obj.pop())
  File "/Users/your_name/src/Closet/exercises/tests/../src/stacks.py", line 14, in pop
    data = self.stack[-1]
IndexError: list index out of range

----------------------------------------------------------------------
Ran 3 tests in 0.000s

FAILED (errors=1)

Nice boundary condition test. Put is a is_empty() check to solve the problem and make the test green.

    def pop(self):
        if self.is_empty():
            return None

        data = self.stack[-1]
        del self.stack[-1]
        return data

Let’s add a few more tests:

    def test_pop_pops_1_item_stack(self):
        test_obj = Stack()
        test_data = 'data1'
        test_obj.push(test_data)
        self.assertEqual(test_data, test_obj.pop())
        self.assertEqual(True, test_obj.is_empty())

    def test_pop_in_correct_order_from_2_item_stack(self):
        test_obj = Stack()
        test_data1 = 'data1'
        test_data2 = 'data2'
        test_obj.push(test_data1)
        test_obj.push(test_data2)
        self.assertEqual(test_data2, test_obj.pop())
        self.assertEqual(False, test_obj.is_empty())
        self.assertEqual(test_data1, test_obj.pop())
        self.assertEqual(True, test_obj.is_empty())

These both pass. Check in the code.

Another Method and More Tests

The other typical method on a stack is peek(), which displays the most recent item to be pushed onto the stack (or the top of the stack). It should be very similar to pop() except it won’t remove the item from the stack, simply return the value. Here are three tests to go with it:

    def test_peek_handles_empty_stack(self):
        test_obj = Stack()
        self.assertEqual(None, test_obj.peek())
        self.assertEqual(True, test_obj.is_empty())

    def test_peek_shows_item_in_1_item_stack(self):
        test_obj = Stack()
        test_data = 'data1'
        test_obj.push(test_data)
        self.assertEqual(test_data, test_obj.peek())
        self.assertEqual(False, test_obj.is_empty())

    def test_peek_shows_top_of_2_item_stack(self):
        test_obj = Stack()
        test_data1 = 'data1'
        test_data2 = 'data2'
        test_obj.push(test_data1)
        test_obj.push(test_data2)
        self.assertEqual(test_data2, test_obj.peek())
        self.assertEqual(False, test_obj.is_empty())
        self.assertEqual(test_data2, test_obj.peek())

and the new method:

    def peek(self):
        if self.is_empty():
            return None

        return self.stack[-1]

That’s it for peek(). Time to check in the code.

One Last Method

To round out our stack, we should add a size() method. Add the tests:

    def test_size_handles_empty_stack(self):
        test_obj = Stack()
        self.assertEqual(0, test_obj.size())
        self.assertEqual(True, test_obj.is_empty())

    def test_size_returns_1_for_1_item_stack(self):
        test_obj = Stack()
        test_data = 'data1'
        test_obj.push(test_data)
        self.assertEqual(1, test_obj.size())
        self.assertEqual(False, test_obj.is_empty())

    def test_size_returns_correct_number_for_many_item_stack(self):
        test_obj = Stack()
        test_data0 = 'data0'
        test_data1 = 'data1'
        test_data2 = 'data2'
        test_data3 = 'data3'
        test_data4 = 'data4'
        test_data5 = 'data5'
        test_data6 = 'data6'
        test_data7 = 'data7'
        test_data8 = 'data8'
        test_data9 = 'data9'
        test_obj.push(test_data0)
        test_obj.push(test_data1)
        test_obj.push(test_data2)
        test_obj.push(test_data3)
        test_obj.push(test_data4)
        test_obj.push(test_data5)
        test_obj.push(test_data6)
        test_obj.push(test_data7)
        test_obj.push(test_data8)
        test_obj.push(test_data9)
        self.assertEqual(10, test_obj.size())

and the method:

    def size(self):
        return len(self.stack)

Be aware of what you might be missing when you review your test cases. It was interesting to me that we didn’t write any specific tests for push()—it can’t really be tested all by itself. is_empty(), pop() and peek() tests all utilize push(). I believe it has been completely tested in this suite of tests.

That’s it for our little stack. Check in your code and let’s have a beer.

In Conclusion

This is really simple example. I hope you can find some value in learning to unit test as you write your code. As is usually the case, there is way more test code than production code. There always is. The more complex the code, the larger the ratio will become. Tests give developers the confidence to change their code, and know they haven’t broken anything in the process. Tests are your friends—I guarantee it. When I choose not to write tests—and, for me, it’s a carefully considered choice—I always seem to regret it later. I write bugs—everybody does. Tests help ensure there are fewer of them.

You can find this code in my repository, python-stack-w-unittest.

Copyright ©2014-17 Ramona Ridgewell. All rights reserved.

Posted in #Education, Coding, GitHub, Programming, Python, Science, STEM | Tagged , , , , , , , , , | Leave a comment

How Insane is That?

This started out as a response to comment made on an Instagram post by Thomas Dekker, whose hometown is Las Vegas. I was not planning to blog about the Route 91 Harvest Festival shootings. It hit too close to home for me when I found out a close friend’s cousin was among the murdered… slaughtered… sacrificed? Thomas posted a photo of a bumper sticker promoting the NRA, with the comment, “Could not be a more unpleasant time to pull up next to a car with this sticker on it. #stopthemadness” The comment that got me going was: “Why? How do you protect yourself? Many of us do not have armed guards to protect us or live in gated community. Read about the history of the Constitution. Check out what the NRA is about. Do not be a sheep. Find out for yourself.”  What follows was my response that comment—it was too long for Instagram to accept. Since I had already spent the time on it, I decided to write a blog post, instead.

It got me going. Here’s a little of the history of the Constitution, The Second Amendment, what a militia is and was, the US Army, the Revolutionary War.

Just as a disclaimer—I grew up rurally—I know how it feels to be out in the middle of nowhere, alone, in the middle of the night. I am fully capable of using rifles and firearms (I’m also a pretty good shot). I am aware that in a home invasion, a good old shotgun is your best defense.

Another side of includes: my best friend lost one of his cousins in Las Vegas last weekend.

I try to be impartial—I understand both views—but I believe we are, collectively, insane to allow the gun violence in our country to continue unabated.

At the time the Bill of Rights was added to the Constitution, in 1791, we had no standing army. Because of “the republican distrust of standing armies,” the Continental Army of the Revolutionary War was immediately disbanded after the war was over. At that point, the states had militias as protection (which were regulated by Congress). These are the militia referred to by “a well regulated militia being necessary to the security of a free state.” As the US Army (which was not formed until 1791, when the Feds realized they could not eradicate the Indigenous People without a real army) began to grow, the state militias shrunk, and, by 1903, were redefined via the Militia Act of 1903 to “organized militia,” which includes state-level National Guard and Naval Militia; and “unorganized militia,” which is “every able-bodied man of at least 17 and under 45 years of age not a member of one of the organized militia”—notice the term “well regulated” was not included.

The 2nd Amendment is fairly ambiguously stated—as the Founders likely intended—so it could be interpreted according to the needs of the current time and populace.

In the 20th and 21st centuries, we have allowed special interest groups (you can read that as groups, like the NRA, supported by people who makes lots of money from their interests—this would be the weapons and ammunition manufacturing lobby—and are willing to spend vast sums to ensure they can continue to make lots of money) to sway the current, legal interpretation to include nearly any conceivable weapon—not only ones intended for self-protection or hunting, but ones intended for killing a lot of people at once. In my opinion, no one should be allowed to own assault rifles. Ammunition should be restricted—for instance, none that pierce body armor should be allowed.

There is nothing in The Second Amendment that prohibits the weapons from be regulated—or the operators of those weapons. The weapons and their operators should be licensed—similar to cars. A lost or stolen weapon would have to reported, tracked and located. An operator should lose his license—and his right to own guns—if he breaks the rules. Only by a special collectors license should an operator be allowed to own more than <some number> of guns or otherwise-banned weapons.

These are rational limitations on gun ownership. Other countries have implemented rules like these—Australia is a very good modern example, where they passed strict limitations even though our own NRA lobbied aggressively there to block the ban. They no longer have mass shootings—their last one was on April 28, 1996, and finally spurred their government into taking action. Their overall gun deaths per year dropped to 0.93 per 100,000—around 3 is the max for all other “first world countries” and most emerging nations. We have 10.54 per 100,000 per year—on par with Uruguay, and 30% higher than places like Mexico, Argentina and Paraguay. Only ten countries have higher rates than The US, including Brazil, Columbia and Venezuela [From Wiki—mixed most-recent years available]

So far this year, there have been 11,793 gun deaths in 47,142 gun-related incidents—which went up by 12 and 31, respectively, since I started writing this about an hour ago. This does not include the roughly 22,000 suicides by gunshot that occur each year. We will end the year around 35,000 gun deaths—this is “normal,” for us—and, we have normalized it. We have the highest gun ownership rate in the world, although, it is impossible to know how many guns are out there because the FBI only tracks applications, not actual purchases—how insane is that?

Guns kill people. It’s really their only purpose. If people didn’t have guns, no one would die from gunshot wounds. #StopTheMadness

Copyright ©2014-17 Ramona Ridgewell. All rights reserved.

Posted in Gun Violence, Las Vegas, Las Vegas Shootings, Life, Murder, NRA, Polarized America, Route 91, Route 91 Harvest Festival, Route 91 Harvest Festival shootings, Thomas Dekker | Tagged , , , , , , , , , , | Leave a comment