Posts Tagged 'bible'

My Daily Bible Reading, automated

Bible and glasses

Readers, be warned: this is one of those geeky posts of mine. I basically put these up to remind myself how I did something.

One thing I’ve noticed is that I tend to be much more intentional about reading what shows up on my computer screen than I am in reading a physical book. Everything I want to read (almost) can be found at my fingertips through the internet.

Now, like some of you, I have tweaked the settings in my browser so that the tabs to which I always need access are set to open as default. And I thought how neat it would be to create a script that would take my daily bible readings, and put them into a webpage so that I would read the text as I start my day.

The challenges:

  1. To insert the text according to my preferred reading plan (by Grant Horner, found here).
  2. To set up a web page for each day of the year with that day’s readings.
  3. To serve each day’s webpage to my browser.

Here’s how I did it.

To set up the text the way I wanted, I wrote a script using the excellent tool “diatheke”. It’s a command-line tool that comes with my bible program (Xiphos, in case anyone is wondering). Diatheke allows me to search and select Bibles for verses (or topics, or phrases), and use the results of that search in lots of interesting ways. I won’t show you the whole script, but I will show you a line of the file, and explain what it does.

diatheke -b ESV -f HTML -k Matthew 1, Genesis 1, Romans 1, Job 1, Psalm 1, James 1, 1 Samuel 1, Isaiah 1, Acts 1, Proverbs 1 > biblechapter1.html

“diatheke” is the name of the program. “-b ESV” selects the version to read. “-f HTML” selects the format that will create a webpage. “-k Matthew 1, Genesis 1, etc.” selects each chapter of each book I want to read. And finally “> biblechapter1.html” puts all of the gathered information into a single webpage (called biblechapter1.html”).

The script does this 365 times, with the different chapters that I want. After running it, I now have 365 little webpages with just the text of Scripture for that day of the year.

INSERT EDIT: After having used this for a few days, I noticed that the version of diatheke has an annoying little bug in it: it appends the last verse of whatever the search terms as an extra line. I wanted to get rid of this extra appendage, and I used the following command to do it.

sed -i “s/^: .*/<br>/g” biblechapter*.html

“sed” is the Stream EDitor program on most Linux systems, and with the input -i, the specific command s/ switches every line that starts with a colon and a space ^: , no matter what comes behind it .* with an HTML carriage break <br>, and does so globally /g for every file that starts with the name biblechapter, and ends with .html.

Finally, I wrote a little “home page” file that would select a different Biblechapter page depending upon the day of the year. This one page has a script that calculates the day of the year, and then serves that numbered biblechapter file to my browser. Here’s what that file looks like, shortened for readability:

<html>
  <body>
<script type="text/javascript">

var ie=document.all
var doy=document.getElementById

//How will the IFRAME be displayed?
var iframeprops='width=1400 height=6000 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="yes"'

//Show all days of the year
var daycontent=new Array()
daycontent[1]="biblechapter1.html"
daycontent[2]="biblechapter2.html"
.
.
.   all the way through the whole year, 1 - 365
.
.
daycontent[364]="biblechapter364.html"
daycontent[365]="biblechapter365.html"

if (ie||doy)
document.write('<a href=""></a>')

var now = new Date();
var start = new Date(now.getFullYear(), 0, 0);
var diff = now - start;
var oneDay = 1000 * 60 * 60 * 24;
var mytoday = Math.floor(diff / oneDay);

function dayofyear_iframe(){
if (ie||doy){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=daycontent[mytoday]
}
}

window.onload=dayofyear_iframe

</script>  </body>
</html>

Once that was working, I simply had to tell my browser (Chrome) to open three tabs every time it started: my calendar, my email, and my Bible reading for the day.

Well, that’s what works for me. Are you using some kind of system or specific discipline to keep you in the Word… and the Word in you?

Thoughts on Scripture study

Because it did strike me that I had been wanting to interrogate the Bible, I was a literary critic by training, and what literary critics do is they interrogate things. And so it struck me that I was in the posture of the interrogator. It did make me wonder though. The whole premise of an inerrant and inspired Bible – the premise of it is that the Bible then interrogates you. You don’t interrogate it. And the justification for that is that the Bible is written by a holy God. And I had to stop and think for a moment because, you know, if God did create the heavens and the earth and everything, and if God did set apart a people for himself before he made the stars and the sand, you know every little leaf on a tree, then nothing is higher than God. And therefore, God does have the authority to interrogate me.” (The Secret Thoughts of an Unlikely Convert: An English Professor’s Journey into Christian Faith, by Dr. Rosaria Butterfield)

I’m posting this quote here because:

  1. I thought it was really insightful – we read the Bible… and the Bible reads us.
  2. I’m going to want to use this in a sermon someday, but it doesn’t really fit for anything I’m preaching soon.
  3. Because it doesn’t YET fit — but it’s too good to not use — I want to remember that I read it, and my blog is a good spot for these kinds of things.

So, I’ll tag this under “sermon fodder” so I’ll know to return to it someday. It will be interesting to see how long this will take before it’s used. Hopefully, I’ll remember to update this post whenever I use this quote.

BASHing the Bible

Hello, readers. Before any of you get up in arms about the title of this post, relax, take a deep breath, and read on if you’re interested in inserting Scripture into documents, because that’s all this post is about.

The church I serve recently got a new laptop for my use (yay, thank you trustees!), and while it already had Windows 8 pre-installed, I carved out some space on the hard drive, and installed Linux, because that’s what I actually use.

So, that means a new installation for me. I *thought* I had transferred all of my favorite little tools and scripts that I put together from my old laptop, but apparently, I had forgotten a couple, including some BASH scripts that I used every single week in my sermon preparation. BASH means “Bourne Again SHell”, a scripting language for Linux and OSX (and yes, it’s also available on Windows). A script, for those of you who are Windows users, is like a batch file. You put a bunch of commands that you want run in sequence in it, and then just run that script. (Anyone remember AUTOEXEC.BAT?)

What I want to do is insert Scriptures into my text documents. How I’ve ended up doing this is by using a couple of tools, and chaining them together. This is done on an Ubuntu Linux system – your milage may vary. Frankly, I’m writing this post so that if I ever have to do this again, I won’t have to do it from scratch. Again.

Tools you’ll need:

  • diatheke – a command-line tool that uses the Crosswire Bible libraries. All of my Linux Bible programs are in this format, so this is what I use.
  • gtkdialog – a neat little tool that allows me to make fancy GUI front ends for scripts.
  • xclip – this command-line program allows me to specifically insert things from the command-line into the clipboard for use in GUI programs.

So, the workflow is this:

  1. Select the Bible references you want to use in your document.
  2. Tell the bible retrieval program (diatheke) which verses you want.
  3. Capture the results from the retrieval program in the clipboard.
  4. Paste the contents of the clipboard into your document.

If this seems a *lot* like ZipScript from the old WordSearch programs, you’ll know where I got the idea! Here’s the actual script itself.

#! /bin/bash

export MAIN_DIALOG='
<window title="Scripture Grab-O-Matic" icon-name="gtk-preferences" resizable="true" decorated="true" width_request="225">
 <vbox>
  <text><label>What NIV Scripture do you want?</label></text>
   <entry activates_default="true">
    <default>John 3:16</default>
     <variable>ENTRY</variable>
      <action>diatheke -b NIV -k $ENTRY | sed "s/^:.*//g" | sed "/^(NIV)/d" | xclip -selection c</action>	   
    </entry>
   <hbox>
    <button can-default="true" has-default="true" use-stock="true"></button>
   </hbox>
  </vbox>
</window>'

gtkdialog --program MAIN_DIALOG

UPDATE: in the middle of the action tag, there’s a couple of extra sed entries. These are placed here because diatheke keeps repeating the last line of whatever verses were requested. These sed commands remove the extra data, and the version label.

I don’t know if this will help anyone but me, but it’s a handy little script.

dialog box for Bible text

Scripture Grab-O-Matic dialog box

And here’s the code snippet that is inserted into Libreoffice. This simply calls a bash script to run. I made my script listed above executable, put it in my /usr/local/bin/ directory (where I put all my local stuff), and when I run the macro in Libreoffice, the bash script is launched.

Sub NIV
Shell "bash -c NIV"
End Sub

Bible names – mining for insight

hebrew names As I was doing my study this morning, I found myself in Genesis 5, and there are a lot of “begats” in there…

Every time I’ve read them before, I’ve basically logged the names mentally, but not really paid much attention to them until a specific name showed up later in the text, or had some special comment made about it…

…but then it occured to me: my own daughters have very specific names, chosen for very specific reasons. There’s a story behind each name in my family; indeed there’s a story behind how Jami and I even came to choose various names. Why would I automatically assume that Bible names didn’t have much meaning to their parents and treat them like mere footnotes in history?

Enter this site: Abarim Publications. They have some *great* Hebrew insights as to the meaning of names in the Old Testament. Even better – they explain, using the Hebrew, WHY they give a specific meaning to a particular name. It was a fascinating look at the names in Genesis 5, and one does not need to be a Hebrew scholar to appreciate the information on a name.

I recommend taking a look at this site: if you have a name that’s Hebrew in origin, you might discover all kinds of things about your name that you never knew!

Shalom (KFJ)- Ed


Pastor Ed Backell

Flickr Photos

teepeeindiangirls1

x-default

rachelthrone

More Photos

Pastoral Tweets

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 753 other followers


%d bloggers like this: