John's Blog

Everyone and his dog has a 'blog these days, right? So why not me? If you are interested in anything I'm saying, great! Let's talk about it! (Leave comments.) If not, try one of my other links. Better yet, why are you wasting your time staring at your computer screen, go do something real!

Let me know if you'd like to be to be updated whenever I post a new article. It won't happen every day!

Falsehoods from Stand for Marriage Maine

Sunday, October 04, 2009
This morning I was doing some research on both sides of Maine's "Gay Marriage" referendum, Question 1 on the November 2009 state ballot. I found some misinformation on the Stand for Marriage Maine site (the group leading the repeal effort, to overturn gay marriage), which I'll use this site to clear up, at least according to my knowledge.(Click title to read more...)

Following is the text of their Q&A page, quoted, with my responses unquoted afterward.

Questions & Answers About Question 1

What is Question 1?

A People’s Veto is a simple and straightforward voter-initiated measure that gives voters the power to decide if they accept or reject an act of the legislature. More than 100,000 Mainers signed the petition to place this People’s Veto on the November ballot as Question 1 to repeal the recent same-sex marriage proposal (LD 1020) passed by Maine’s legislature.

Passage of the Question 1 will restore the definition of marriage as between one man and one woman by asking the citizens of Maine, “Do you want to reject the new law that lets same-sex couples marry and allows individuals and religious groups to refuse to perform these marriages?”

Marriage is a pillar of society and should be protected from distortion by politicians and homosexual marriage activists who want to redefine it to suit their objectives.

Question 1 will preserve the centuries-old definition of marriage.

What does a Yes Vote Mean?

Voting Yes on Question 1 does several important things:

* It restores the definition of marriage to what Maine Law has always been and human history has understood marriage to be: between a man and a woman
Marriage has also been many other things throughout human history, most notably a means of soldifying political bonds between countries by the marriage of their royals and nobility, completely separate from any romantic interest between the partners. In such a political marriage, procreation is valued entirely for its political advantage (producing heirs for both kingdoms). Marriage has also often been denied to couples of differenting ethnicity. My point is simply that marriage is hardly the monolithic unchanging institution that this page wants to present it as. Marriage has always been more complicated than that.

* It maintains the rights and benefits of Maine same-sex couples who are covered by our domestic partners law. A YES vote does not take anything away from homosexual couples, but protects traditional marriage.
See more on this below.

* It protects our children from being taught in public schools that “same-sex marriage” is the same as traditional marriage as happens in Massachusetts, where children as young as the second grade are being taught that they can grow up to marry either a boy or a girl, and either option is the same, while parents cannot opt their children out of such “instruction.”
In Massachusetts, teaching on marriage is legislated into the school curriculum, and was so even before gay marriage was legalized there. Maine has no such curriculum requirement, and the law legalizing gay marriage here does change this. This example is simply not applicable here.

* And, a Yes vote on Question 1 puts the power in the hands of the voters, not politicians!
If policy regarding treatment of a minority were always left to the votes of the majority, we would probably still have Jim Crow laws in the South.

What does a NO Vote Mean?

If Question 1 is defeated, LD 1020 will take effect and the sanctity of marriage will be destroyed. Maine law will no longer promote monogamous marriages and the interests of children. Marriage’s powerful influence on the betterment of society will be lost.
An amazing amalgamation of unfounded or just plain false claims here.

"Sanctity of marriage will be destroyed" - Surely sanctity is in the soul of the beholder? I think they refer to the sanctity of their definition of marriage. Will having gay and lesbian couples participate in viewing their commitment as sacred somehow "destroy" it? Doesn't it just enlarge the pool of people allowed to participate in a sacred institution? "Destroy" is a strong word, not to be tossed around lightly.

Secondly, sanctity is a religious concept, and the legalization of gay marriage in Maine makes no requirements that any religious institution change it's religious definition of marriage.

"Maine law will no longer promote monogamous marriages" - Completely untrue. The gay marriage law does not permit multiple-partner marriage.

"Maine law will no longer promote ... the interests of children" - Most studies that Stand for Marriage references to "prove" this point compare two-parent heterosexual families with one-parent families, not to two-parent homosexual families. I have heard of no studies comparing the latter to two-parent heterosexual families with negative conclusions.

"Marriage’s powerful influence on the betterment of society will be lost." - Again, a strong but unfounded statement. "Lessened" would maybe be a more arguable claim (although the lack of studies proving so would make it harder to argue), but "lost"? No. The rate of gay marriages will still be much lower than the rate of straight divorces, which are well-known to be have a stronger negative effect to society and children. And there are plenty of gay parents who are lovingly and monogamously raising psychologically healthy children, certainly bettering society in the process.

The defeat of the Question 1 would result in the very meaning of marriage being transformed into nothing more than a contractual relationship between adults.
Which is all civil marriage is to the state, the only entity which is affected by this law.

No longer will the interests of children and families even be a consideration.
The interests of children and families is already not a consideration when a straight couple applies to the state for a civil marriage license.

Defeat of Question 1 will mean that homosexual marriage activists will have been able to redefine marriage for all of society, even for those people who have deep objections to it.
Only civil marriage, not the religious practice for any religious institutions.

The marriage between a man and a woman has been at the heart of society since the beginning of time.

It promotes the ideal opportunity for children to be raised by a mother and father in a family held together by the legal, communal and spiritual bonds of marriage.

And while divorce and death too frequently disrupt the ideal, as a society we should put the best interests of children first, and that is traditional marriage.

Voting No on Question 1 would destroy marriage as we know it and cause profound harm to society.
This has already been covered above. The site is repeating itself.

Will Question 1 take away any rights for gay and lesbian domestic partners?
No.

Question 1 doesn’t take away any rights or benefits from gay or lesbian partners who are covered by Maine’s domestic partners law.

Maine law guarantees gay couples many of the rights offered to heterosexual couples.

Passage of Question 1 will not change that.
A contradiction. First it says repealing the gay marriage law won't take away any rights or benefits of gay or lesbian partners under the domestic partners law, then it says that that law "guarantees gay couples many of the rights offered to heterosexual couples". This implies that the domestic partners law does not provide all the same rights that marriage would, so repealing this law will take away whatever rights the marriage law provides that the domestic partners law does not.

Federal law controls other rights and changing the definition of marriage in Maine similarly won’t change that.
This is true. So even with the gay marriage law, gay and lesbian couples will not gain the federal benefits of marriage. But without it, they will additionally lack many of the state benefits.

If Question 1 does not pass, will my children be forced to learn about homosexual marriage at school?
Yes.
No!

Without Question 1, teachers will be required to teach young children that there is no difference between homosexual marriage and traditional marriage and parents will lose control over what their kids learn in school about marriage and sexual orientation.

This is not a hypothesis.

It has already happened.

In states like Massachusetts where same-sex marriage has been legalized.

Children as young as second graders are taught that there is no difference between marriage and same-sex “marriages.”

Worse, parents who do not want their children exposed to this homosexual marriage instruction have been denied an opportunity to opt their children out. (See Parker vs. Hurley)
Maine is not Massachusetts. Our laws are different. This has already been clarified up towards the top of this essay. Parker vs. Hurly took place in Massachusetts, and has no relevance in Maine (because it involves laws which Maine does not have, and because cases in states other than Maine have no legal power of precedence in Maine.)

Why was a People’s Veto needed? Don’t we already have a law clarifying the definition of marriage?

“An Act to Promote Marriage Equality and Affirm Religious Freedom” was passed by the Legislature and signed by the governor on May 6, and is scheduled to take effect 90 days after the adjournment of the Legislature in mid-June. Without a People’s Veto, Mainers will be denied the right that voters in 30 other states have already exercised, which is to decide this critically important question for ourselves. It is wrong for politicians and homosexual marriage activists to redefine marriage for all of society without giving Maine voters an opportunity to have their say.

Who supports this initiative?

A wide range of national, state and local pro-family organizations, churches and individuals have formed a broad-based coalition to enact a People’s Veto, which more than 100,000 Mainers supported to qualify for the November ballot.

People of a variety of different faiths stand united in preserving the definition of marriage in Maine.
And people of a variety of different faiths also stand united in enlarging the definition to included committed and monogomous gay and lesbian couples.

To view a list of supporters, visit www.standformarriagemaine.com

What will happen to the existing same-sex partnership laws if Question 1 passes?

Nothing.

All laws on the books regarding same-sex couples will remain intact.

Gays and lesbians in a committed relationship will continue to enjoy all the legal rights and benefits that married couples enjoy, under existing Maine law. Question 1 does not affect those rights and benefits.
You just said above that they have many of the same rights, not all. Which is it?
Where can I find more information about Question 1 or get involved in the campaign?

You can visit the People’s Veto site at www.standformarriagemaine.com or send an email at info@standformarriagemaine.com.

There are a number of ways to get involved with the campaign, including volunteering, donating and helping to spread the word about the importance of voting YES on Question 1.
For more information on marriage equality, including volunteering, donating and helping to spread the word about the importance of voting NO on Question 1, see protectmaineequality.org

Labels:



0 comments

History and my current opinion on bike infrastructure

Monday, December 22, 2008
[ Time for the yearly post! :-) ]

I'm enjoying learning more about the social history of cycling transportation, especially as it relates to the current debate over bicycle infrastructure. As someone who "got back into riding" as an adult, mainly for transportation purposes, I didn't have the benefit of a club to educate me about how to ride properly in traffic, yet I have managed to learn standard vehicular methods and believe they are the best way to go. I don't need bike lanes or paths; I'll just use the same road as motor vehicles. Furthermore, I believe that most other adults who already know how to drive a car in traffic can learn the same, without depending on bike lanes and paths. Yet, bike lanes and paths are usually the first thing people think of when they think about bettering the biking environment and getting more people riding. It's a dilemma for me as I think about where to put my advocacy energy.(Click title to read more...)

What I've been reading lately is John Forester's Bicycle Transportation: A Handbook for Cycling Transportation Engineers. Forester is considered the premier "vehicular cyclist", having also written the book Effective Cycling, considered the "bible" of the field, and the basis for national cycling education in the United States from the League of American Bicyclists. Forester was smack in the middle of a big change in the United States during the 1970's towards the emphasis on bike lanes and paths (which he opposes), and the change of laws that came with them, and as a result holds very strong opinions about what happened during that time. Because of that, reading him is sometimes difficult, as he relates his own point of view on what happened, and goes further to berate the motivation and sometimes even intelligence of those who took (and continue to take) an opposing viewpoint. Yet, he very clearly knows a lot about his subject, and it is very enlightening, if nothing else, to read the history.

The history, as I understand, not having been there, is as follows. The concept of bicycle clubs date back to the late 19th century, when cycling was primarily the province of fit young men of means, riding those large-front wheeled machines you sometimes see in historical pictures. There was no rear-wheel chain-drive yet -- the pedals were attached right to the front wheel, so the only way to increase the forward distance of each pedal stroke was to increase the size of the wheel. When chain-driven bikes were introduced in the very late 19th century, it meant that more people were physically able to ride, and the development of mass-production in the early 20th century brought the price down to the point that more people were able to buy them, and the idea of bicycles as practical transportation was born.

The bike clubs were the early promoters of what has been called the "good roads movement", advocating for paved roads before cars even entered the picture. Indeed, the question of bicycles as legal road vehicles, alongside horse-drawn carriages, had already been taken up and mostly decided in the positive. There was no such thing as the "bikes to the right" law at that point -- bikes were the fastest things on the road! It is interesting to note that when cars came along, there was initially a question of whether they would be afforded full rights to use the road, alongside horse-drawn carriages and bicycles! Obviously, they eventually were, thanks to the efforts of the automobile industry and other motoring advocates.

The Great Depression, and the Second World War which followed, prevented a full-fledged automobile culture from developing as fully during those eras as it later did in the 1950's. However, the idea of mechanization was on the march, alongside the war effort of the Allied and Axis powers. Wikipedia notes that Nazi Germany viewed the bicycle as an impediment to its goal of mass motorization, and in response, was among the first countries to push for bike lanes and paths, with the stated goal of excluding bicycles from the roads. In the United States, 1944 was the year that the "ride to the right" law was first enacted and inserted into the Uniform Vehicle Code (which is the vehicle code of no state in particular but exists as a national model on which many states may base their own code). The initial version of this law contained no exceptions! Forester believes that almost no cyclists knew about or at least opposed this because they were all fighting overseas or otherwise too busy with the war effort to know or care.

After the war, automobile culture took off, and cycling became largely limited to recreational cyclists in the cycling clubs that still survived, sometimes with only a handful of members. These club cyclists knew how to safely share road space with cars, acted vehicularly, and taught their new members accordingly. This club education was often at odds with "official" bike safety advice from non-cycling sources, which consisted mostly of "stay out of the way of cars" (Forester's characterization). According to Forester, many of those "bike safety" rules even advocated riding against traffic or making turns from alongside the curb!

However, cyclists who continued to ride vehicularly were not officially harassed, and there were very few of them anyway, so this uneasy co-existence continued throughout the 1950's and '60's.

The 1970's brought increased environmental awareness, and with it, a resurgence of the idea of bicycles as transportation. This is where things get interesting. Again quoting Wikipedia:
In 1971, the California state government contracted with University of California, Los Angeles (UCLA) for the design of bikeways (bicycle paths, bicycle side-paths, bicycle lanes). UCLA largely copied Dutch bicycle facilities practice (primarily sidepaths) to create their bikeway designs, but the derived designs were not made public. The California Statewide Bicycle Committee (CSBC) was created. Initially composed of representatives of governmental and motoring organizations. When John Forester, a cyclist representative, became a member he concluded that its real motivation for moving cyclists aside was the convenience of motorists, although the stated reason was the safety of cyclists. Serious safety issues were identified with the proposed designs. The resulting cyclist opposition discredited the designs and prevented enactment of a mandatory side-path law. This forced the state to start over with new bikeway design standards in 1976. Those designs were subsequently adapted by the Association of American State Highway and Transportation Officials (AASHTO) to form the first edition of the AASHTO Guide for Bicycle Facilities, which is widely followed in the USA.
From this beginning came the acromonious split between "bikeway" (lanes & paths) advocates and vehicular cycling advocates that continues to this day. Out of this experience also came the addition of "exceptions" to the "ride to the right" law, making clear that cyclists may move left to avoid debris, right-turn-only lanes, to position themselves for a left turn, and so on. Although the initial round managed to defeat a law requiring use of a side path if one exists, several states do now have laws requiring bike lane use if one exists.

It may be somewhat valid to characterize the sides of this debate, as Forester does, as traditional club cyclists representing the vehicular education viewpoint, over against the odd bedfellows of environmentalists who want to promote bicycling as green transportation, and motoring advocates who are willing to go along with that as long as the bikes don't get in the way of the cars. Beginning cyclists who have never ridden in traffic are, of course, very willing to go along with the idea of "staying out of the way of cars", for their own comfort as well as perceived safety.

Muddying the debate is the use of statistics to try to prove one viewpoint or the other. Common sense informs most of the non-cycling public and beginning cyclists that lanes and paths must be safer, and indeed this is the ostensible reason most frequently offered to support the need to build them. Yet statistics consistently show that the majority of bike-car collisions happen at intersections, not on straightaways, and segregated intersection solutions that are both safe and efficient for all users have yet to be identified (in the opinion of the vehicularists, including me). This further means that while offroad bike paths may be great where there are not many intersections, between major connection points such as different towns, opportunities to build paths with minimal intersections are not very frequent in town, and can never go everywhere a transportational cyclist will need to go.

Another common argument against paths for transportation is that they tend to underserve the experienced cyclist who wants to go fast (useful for transportation!), because the paths are often not wide enough to accomodate safe passing and are frequently used by pedestrians and other non-cyclists, slow cyclists, or unsafe cyclists. Critics also note that in terms of bike-bike and bike-ped collisions, paths have a much worse safety record than the road.

From my exposure to the debate, almost no one disputes that bike lanes and paths are more comforting to beginning cyclists (not to mention that they do prevent some inconvenience of motorists), but the difference of opinion is mainly over how much they actually affect safety (and in which direction), as opposed to simply giving the impression of increased safety. Is that impression real, especially compared to the increased cyclist education advocated by the vehicular cycling advocates?

There is also a difference of opinion over the cause-and-effect relationship of bike lanes and paths and the number of cyclists. If lanes and paths make beginning bicyclists more comfortable, the argument goes, more people will do it, and the increased numbers will also make the activity safer by making it the sight of a cyclist more common to motorists. Vehicularists contend that to the contrary, it is the increased numbers of people interested in bicycle transportation, or a perceived imminent threat of increased numbers, that drives the advocacy for more lanes and paths, not the other way around. Personally, I frankly don't know which of these I agree with. They both sound plausible to me.

Another facet of the discussion is how wide a user base will a facility serve? A frequent criticism of the pure vehicular cyclist position is that it works less well for beginners, who haven't yet gained confidence and technique in riding with traffic; for children, who don't yet know the rules of the road; and for senior citizens, who are more frequently nervous around traffic, and whose reflexes and vision might not be what they used to be. I think these are all valid concerns. We do limit adult motorists to trained individuals over the age of 16, and on the older end, those whose vision and reflexes are not obviously impaired. (For cycling, decreased balance and strength are also common issues among the elderly.) I don't think anyone wants to limit the requirements for cycle transportation quite as narrowly as for driving a car, but obviously some of these groups should not be attempting to share the road with cars, either, even with vehicular training. I think that does call for some effort into paths, but with the admission that their bicycle transportation cannot safely be as convenient as that of cyclists who use the public roads, for pure engineering reasons, especially concerning intersections.

So as one of the transportational cyclists who got into cycling for environmental reasons and without the benefit of a traditional, vehicular club education, and someone who does want to advocate for more bicycle transportation, and yet believes that the vehicular behavior is most proper for most adult bicyclists, where should I put my energy?

Here's where I am today: I do not support bike lanes and paths whole-heartedly enough to actively advocate for their construction, especially given that so many others are already doing so. However, I cannot bring myself to be a strong enough critic to publicly argue against them across the board either. For lanes, as long as they stop far enough prior to intersections, I may wish they weren't there but if it makes others more comfortable, maybe that's okay. For paths, if they don't have too many intersections and those intersections are not too dangerous, I still may or may not want or need to use them, but if others do, great.

I conclude for now that my energy is best expended on education of cyclists to ride more vehicularly. I think that will give more bang for the buck in regards to safety, in addition to being more compatible with the advancement of cyclists' right to the road, than bike lanes and paths. I am not comfortable speaking too loudly against lanes and paths, but I will follow their progress locally and speak out against any dangerous or non-standard ones that I encounter, as well as continue to consult in planning efforts regarding them.


0 comments

Yes We Did!

Sunday, November 09, 2008
Here is a cartoon I first ran across in the 1980's, which I have always found very inspiring:


I wonder if cartoonist R.J. Matson had that in mind when he drew this the day after the election:



0 comments

YouTube Music Videos

Saturday, October 20, 2007
Evidently, there is a booming cottage industry, heretofore unbeknownst to me (imagine!), of amateur videographers creating music videos for their favorite groups and songs. At the end of this post is a list of cool videos to They Might Be Giants songs that my boys and I found recently.

I say, it's about time! I was just entering high school when MTV came out, and I remember lying in bed composing a video to Rush's La Villa Strangiato, which of course would involve some kids stumbling upon a haunted house and being chased by monsters. (Diversion: I just created a Raymond Scott station on my Pandora profile. Read it to find out what this has to do with anything.) It was sooooo disappointing to me that most MTV music videos were so lame: the band onstage, the band on the bus, the band lip-synching out in a field somewhere. Where's the storytelling?

So, now YouTube has finally afforded those with a more creative vision (and the production skills) to do better. Following is the list of TMBG songs we have found:


Sadly, still no one seems to have done a creative video to La Villa Strangiato, just plenty of bootlegged concert footage. Any videographers looking for a fun project?

Labels:



0 comments

Automatic Sudoku Puzzle Generation

Wednesday, August 01, 2007
In a meeting today, while the focus was on what others were doing, I entertained myself by thinking about how you would go about creating Sudoku puzzles. I started by creating a 2x2 (easy), then a standard 3x3, using a simple pattern of sequences. That led to thoughts of the general steps required to create any N x N Sudoku, herewith.(Click title to read more...)

My initial 3x3 pattern was:

123 456 789
234 567 891
345 678 912

456 789 123
567 891 234
678 912 345

789 123 456
891 234 567
912 345 678

You see the pattern? First row is in order, each next row starts with the next higher digit than the last.

Then I realized that an easy way to create variations on this is to swap any single row or column within the same large square, which as far as I could tell will not cause a violation of the rules. Finally, you don't really have to start the first row in order, as long as you always shift each subsequent row by one place.

In general, then, here are the steps I've come up with for generating any valid combination for an N x N puzzle, which could be implemented by computer algorithm:

  • Generate row 1 in random order
  • For rows 2 through N^2, take previous row and shift left or right one place (consistently)
  • When finished generating rows, shuffle single rows or columns within the same large square as desired
Now you have a complete solution. To create a puzzle from it, simply blank out single squares as desired, more for harder, fewer for easier.

Some notes: For larger puzzles than 3x3, you must go to letters of the alphabet. This can take you up to 5x5, maybe even 6x6 if you also include numeric digits. Above 6x6, you'd have to include puncuation, which seems kind of silly.

Implementation of this algorithm is left as an exercise to the reader. But if you do, let me know and I'll link to it. ;-)

Labels: ,



0 comments

Querying a database with wildcards

Tuesday, June 12, 2007
Occasionally I have a need to look up something in a database where one or more fields may contain a wildcard. For example, here is a table you could use to see what to call a shape given some of its properties:
nbr_of_sidessides_equalangles_equalshape_name
3**Triangle
4Y*Square
4NYRectangle
***Polygon

So, how do you look something up in this table?
(Click title to find out...)

First, note that in this example, I am using the * character as the wildcard, forcing all columns to be a character type even if they otherwise look like numbers. There are some others ways to do it, but you have to be careful. See below for details. I chose '*' because it is easily recognized as a wildcard in many situations.

You will probably want to put this query into a procedure or function, so that you can reuse it and just pass each set of inputs. Let's say in this example we are passing the number of sides and the two "equal" parameters. We'll call them p_nbr_of_sides, p_sides_equal, p_angles_equal. Using these parameters, your query can be as easy as this:


SELECT shape_name FROM shapes
WHERE nbr_of_sides IN ( p_nbr_of_sides, '*' )
AND sides_equal IN ( p_sides_equal, '*' )
AND angles_equal IN ( p_angles_equal, '*' )
ORDER BY nbr_of_sides DESC, sides_equal DESC, angles_equal DESC


That's it!

How does it work? Easy. For each input parameter, you are selecting rows where the corresponding table column either matches that input, or is the wildcard. So you could potentially match multiple rows, some more specific than others. That's where the ORDER BY clause comes in. Because '*' (and most other punctuation) has a lower sort value than numbers and letters, we tell it to sort the results DESCENDING, to ensure that more specific matches are listed first. This is like Google returning search results in order of most likely to less likely. This ensures that the first row of multiples (if any) is always the most specific, thus the one we want. Try it for several variations of input and see for yourself!

In your procedure, then, just return the results from the first row and discard the others. Syntax for all this will vary by database platform, and so is intentionally left as an exercise to the reader.

So what about that '*' as the wildcard? There are some drawbacks. As noted above, you may not want to force all your columns to be character type if the specific values are all numbers. You might be tempted to just use NULL, but I'm not sure how that will be treated in the ORDER BY, and it may well vary by platform, so I would advise against that. The '*' may also not be the greatest choice if you expect that your column could start with other punctuation, some of which sorts lower than the asterisk. (See any ASCII table for actual values.) This shows that a series of spaces may actually be the best value for character fields, since the space is lowest sorting printable character.

The bottom line is that any non-NULL "special" value will do, as long as it sorts lower than any of your expected actual values. For numeric columns, if you know you will only have non-zero positive values (like in this example), 0 would do. Or some negative low number such as -9999999.

Hope you found this helpful.

Labels: ,



0 comments

Finding the last day of week before a given date

Wednesday, June 06, 2007
Occasionally I need to derive the formula to find the last (whatever day of week) before a given day, such as the previous Sunday or the previous Monday. I do this so infrequently that I always forget where I have already done it or what the formula is, so I usually derive from scratch every time. I could Google for it, but I figure that would take about as long as deriving it would. But, now that I've done it yet again, maybe if I put it in my blog, I'll be able to find it easily the next time. Or maybe it will even help others who might find it by Googling, maybe you! (Click title to read more...)

I'm trying to keep this language-independent, but there need to be some givens:
  1. You have a function in your language to return a day of the week as a number. In this case, I'm assuming 0 = Sunday to 6 = Saturday, which is the standard for C and its derivative languages like Perl and PHP. Alternately, the MS Excel function WEEKDAY returns 1 = Sunday to 7 = Saturday by default, so you would implement this formula in Excel by simply subtracting 1 where the variable w is used. (I used Excel to test this.)
  2. You need a modulo function. In C, Perl, PHP, etc., this is the binary operator %, so that's what I use here. MS Excel and some others use the function MOD( n, m ) instead.

Given Variables:

  • w = Day of Week (DOW) number of the date you are starting from, such as today. This will be 0 - 6 as described above.
  • e = DOW number of the date you are trying to go back to, such as 0 to find the previous Sunday, 1 to find the previous Monday, etc.

We want to find the number of days between our starting day and the day we are going back to:

Difference in days (d) = w - e. The sticky point is that we need to provide for "wrapping around" to the prior week. To do this, we add 7 and then modulo the result by 7:

d = ( w - e + 7 ) % 7

Now we just subtract this number of days from the current day. How this is done depends on your language.

In languages that represent date/times as a number, with the whole part being the day and the decimal part being the time, you can just subtract as a number. For example, in my MS Excel testing spreadsheet, if the starting date (maybe today) is in cell A1, and I'm going back to the previous Monday (DOW 1), the formula is:

=A1 - MOD( WEEKDAY( A1) - 1 - 1 + 7, 7 )

Note that we subtracted 1 from the WEEKDAY function to make it 0-6 instead of 1-7, and used Excel's MOD function.

In a language such as C, where timestamps are represented as number of seconds since a fixed time (like Jan 1 1970, the Unix epoch start), just take d and multiple it by seconds in a day, 86400, and subtract that from the starting day to find the finish day.

Or, your language may have a date difference function where you can specify the number of days.

Hope you found this helpful!


Labels:



2 comments

Human-Caused Climate Change - Is the Debate Over?

Tuesday, January 09, 2007
We've been hearing a lot about in the last year from the left that "The debate is over. Climate change is happening, and it is being caused by humans." Predictably, there is much hue and cry from skeptics that this is simply self-fulfilling prophecy that attempts to stop further questioning.(Click title to read more...)

I think we shouldn't get sidetracked into a discussion whether the debate is over or not. It's a very subjective statement. Obviously, "the debate is over" does not mean that everyone agrees. Some people fervently deny that the earth is more than 6000 years old, and we are either misinterpreting the dinosaur evidence, or maybe they lived at the same time is early humans. Does that mean that the scientific debate about the various ages of the earth (Jurassic, etc.) is not yet over? What about people who doubt that the earth is round? That the earth revolves around the sun? That apartheid was bad? (Yes, getting away from science now.) That the holocaust happened? Are those debates still "open"?

So, "the debate is over" does not mean that there are no more dissenters at all. Should we then define it as saying that some threshold percentage of believers has been reached, maybe a majority? But on a scientific question, that quickly morphs into a debate about whose opinion matters. A researcher whose educational background is not actually science but happens to be working on the issue anyway? Those people exist. Someone whose educational background is scientific, but in another area of science? They exist too. Does it matter who is paying them? In some cases, undoubtedly. We could come up with any percentage depending on whose opinion we count as mattering.

I think it's really a political question. In fact, I'm not a rhetorician, but I'd wager this is a standard rhetorical device, to just proclaim that everyone agrees with you. It may be true that in different countries, one side or the other has captured the majority of public opinion, or even scientific opinion, and maybe one opinion does prevail in the majority of countries. So maybe you could say that "the debate is over" in certain countries. The reality for the United States, for better or worse, is that the debate is still not over, at least in a political sense. I think those who want it to be "more over", from one point of the view or the other, would better spend their time continuing to convince than to argue about whether it's over or not.

A few thoughts on scientific certainty: Science consists of facts and theories. Facts are merely the observed phenomena, theories are the potential explanations. Theories are strengthened or weakened depending on how well they agree with the facts, as shown by experimentation over time, but theories never, ever turn into fact. Gravitation is still just a theory. Newtonian physics was a fairly well-accepted theory until Einstein. Theories are always being modified or even replaced. When it comes down to it, all theories are just stories we've made up to explain the facts, and science is merely the methodology to compare the validity of competing theories.

Some people seem to unrealistically expect a theory to be "correct" in a way that can be proven beyond the shadow of a doubt. I think that's a fundamental misunderstanding of science. Almost every theory now in existance has some facts which are not explained by the theory, and those that don't, no doubt someday will. The existance of facts that don't fit the theory of course means that the theory needs at least some refinement. It may or may not mean that the theory is flat-out wrong. Yet that's the conclusion that some, armed with conflicting facts, want to jump to.

Labels: , ,



0 comments

Thoughts on adding bike lanes

Monday, November 27, 2006
Bikes are schizophrenic - they are both recreational vehicles driven on paths and neighborhood streets by riders of all ages and experience levels, as well as a means of transportation, sometimes the sole means, by experienced riders with traffic skills at least on par with the average car drivers. American society in general, and transportation policy in particular, therefore continues vacillate between these two views. (Unfortunately for the skilled traffic riders, the recreational view has always seemed to have the edge, and probably still does.) (Click title to read more...)

A sophisticated view of the situation should allow for both kinds of uses, recreational and transportational. It would be both stupid and impractical to force all users of bikes to have licenses and take classes in traffic safety, if they only intend to ride slowly in the park or on a multi-use path. However, it is also impractical and short-sighted to disallow strong and skilled cyclists from the public roadways. It may even be unconstitutional in that it amounts to restricting a certain class of users from a public space.

It is not surprising that the most controversial area of this bipolar approach is at the transition point between the two kinds of cyclists. Inexperienced cyclists who are only out to have a relaxing recreational ride will naturally stay away from high-traffic areas. On the other hand, transportation cyclists going from point A to point B will tend to take the most direct public roadway, regardless of any bike-specific facilities.

The intersection here is the potentially large group of cyclists who would like to ride for transportation, but who lack the confidence to try riding on the road with cars. Therefore, city governments who want to be seen as doing something for cyclists, as well as a great many cyclists themselves, advocate for bike lanes, as a facility to improve the confidence of cyclists and to assist in keeping them separated from the cars. However, some experienced cyclists see bike lanes as confusing to motorists and promoting a false view that the facility makes up for the lack of additional training on traffic riding among inexperienced cyclists. In addition, some bike lane designs are better than others, and all bike lanes create additional maintenance tasks for the city. These advocates therefore favor a more education-based approach and tend to oppose bike lanes in general as unneccesary and creating a segregated mindset which really does nothing for bike safety. They feel that existing non-bike specific traffic laws and facilities are sufficient for *experienced* bike riders as well as cars, and to the extent that bike lanes diminish the expectation that bike riders have all the same rights and responsibilities as motorists, they are to be avoided in favor of additional driving training for cyclists.

Having all these thoughts in my mind, I admit that I am totally on the fence! Please discuss.

Labels:



0 comments

All I have to say about the Da Vinci Code

Tuesday, May 16, 2006
(At least for now...)

With all this hoopla over the release of The Da Vinci Code movie, it might be good to remember how outraged the West got over how outraged the Muslim world got over those Danish cartoons, or, for those with longer memories, Salman Rushdie's Satanic Verses. "They don't value free speech like we do", some people said. Is turnabout fair play?
How can you say to your brother, 'Brother, let me take the speck out of your eye,' when you yourself fail to see the plank in your own eye? You hypocrite, first take the plank out of your eye, and then you will see clearly to remove the speck from your brother's eye.
- Luke 6:42

Labels: ,



0 comments