How to Spot Satellites without a Telescope



Recently I installed the Heavens Above application for an Android phone, experimented with it, and managed to see three satellites with the naked eye within a space of about ten minutes. This was at least two hours after sunset.

In the settings. set the magnitude to 4 – this should be the default anyway. The Sky Chart will often display the position of multiple rockets and satellites.

The application will also display the flight path of a given object when the user taps on it.

All you need now is a clear night, and wait for the Sky Chart to show a satellite about to pass overhead. They seem more visible overhead, and it’s easier to notice their movement. What you’re looking for is something that appears like a moving star.


Setting Up a Data Source Using the Code-First Entity Framework Model


, , , , , , ,

Since most my .NET projects for the past several years have been for clinical systems, I’ve been working from Database-First Entity Framework models. The software needed to be designed around whatever database schemas and stored procedures already existed, and data models needed to be generated from them. So, it’s only quite recently that I’ve looked at Code-First models, which seem more appropriate to situations in which we’d want a database schema to evolve as an application is being developed.

With the Code-First method, the data model is defined in the application’s code, and we sync the changes to the database.
To try the following example, you’ll need to create a new ASP.NET MVC project in Visual Studio, and ensure it’s created with the ‘Individual User Accounts‘ option (click the ‘Change Authentication‘ button when choosing the template), as I’m using classes within a file called ‘IdentityModels.cs‘ to set up the initial model and schema. When the project is loaded, right-click on the project and select ‘Manage NuGet Packages…‘. If Entity Framework isn’t already installed, install it.

We should be set up for the first step. It might be worth hanging onto the project if you’re following this example, because a future post will be going into developing the controllers to read and write data using this.

Generating the First Migration Script and Database From IdentityModel

First let’s take a look at the IdentityModels.cs file, as the two classes in here are important for understanding the Code-First method. The first class is ApplicationUser. I’m still not entirely sure how it works, as the implementations are hidden, but it uses IdentityUser as its base class, and I want to later extend an instance of this with a property that defines the application user name.

The second is the DbContext. Currently it references a connection string in Web.config named ‘DefaultConnection.

In my project, these classes are within the namespace ‘CodeFirstExample.Models‘.

Now it’s possible to generate a database table and its schema from this by using the Migrations tool, which is run in the Package Manager Console – find this in ‘Tools‘ – ‘NuGet Package Manager‘ – ‘Package Manager Console‘. Basically this is a PowerShell command line interface, and we can do more than simply fetch and remove packages.

PM> enable-migrations
PM> add-migration InitialMigration

The console should contain:

PM> enable-migrations
Checking if the context targets an existing database...
Code First Migrations enabled for project CodeFirstExample.
PM> add-migration InitialMigration
Scaffolding migration 'InitialMigration'.
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration InitialMigration' again.

We should also see a Migrations folder appear in Solution Explorer, containing a [migration name].cs file. This will have C# methods containing code that looks very much like SQL – these should be easily translatable to actual SQL scripts.

To execute the migrations script, run the following command:
PM> update-database

Now refresh the SQL Server Object Explorer window. If there is no configuration string included in Web.config or the connection string name isn’t specified in the DbContext, Entity Framework will create a database locally. Since I’ve already got SQL Server Express installed, the new schema appears under that connection name.
The new database will be called something like ‘aspnet-[project name]-timestamp’, and it’ll have tables for the ApplicationUser identity. The table it uses for local accounts is dbo.AspNetUsers.

If the application was run, the login and register features should be functioning, and the [Authorize] attribute can be set on any controller action. A user could register and modify an account, and the login details will appear in the database table.

Creating Our Own Model

Next I’ve defined my own model for a calendar application, by adding two classes: MyCalendar and EventType. In the Models folder, I’ve created another class file called ‘MyCalendarModel.cs‘, and added the following code into it:

I want to also add the following import statements, in addition to the defaults:

using System.Data.Entity;
using System.ComponentModel.DataAnnotations;

Also, what I typically do with the model is add validation attributes. I think it’s safer and better to sort out the validation here rather than implement it solely in the view layer. I did also assume that these attributes would also give us more precise control of the data types in the database tables, but that doesn’t seem the case.

Adding the Model to DbContext

Now we have two extra models that wouldn’t do anything unless they’re added to the DbContext class, so I’ve added them here.

I then cleaned and rebuilt the project, just to make sure there were no obvious errors before executing another migration.

Generating the Migration Script and Applying the Changes

Similar to what I did previously, but the migration is given a different name so I’d know later which script does what, and I’ll need to force the update-database command to overwrite the existing schema:

PM> add-migration AppendMyModels
PM> update-database -Force

In Server Explorer there’ll be two additional tables, EventTypes and MyCalendars, that were created by running the above on the migration script. The only thing I needed to do after that is populate the EventTypes table, as it’s there for populating a drop-down list.

Also, if we look in the table definition, we can see the data types have been loosely applied from the attributes in the model class, and primary and foreign keys were set.

Final Thing: Populating a Database Table for an MVC Drop-Down Menu

We could populate the EventTypes table by entering the values into it using Server Explorer, but doing it from a migration script enables us to replicate the changes with other databases much faster. For this, I’d need a black migration script template, which can be generated by running ‘add migration PopulateEventTypes

I’ve populated the Up() method with a series of SQL INSERT statements. I’m assuming the other method, Down(), fetches or pulls things from the database.

Now run the migration script again, using ‘update-database‘ to populate the database table. Viewing the EventTypes table in the SQL Server Object Explorer, we should see it populated.

Aikido: Traditional Art and Modern Sport


, , , ,

This book, by Brian M. Bagot, is definitely on my recommended reading list as a training manual and revision material for kyu gradings. I also recommend it to anyone seriously thinking about joining a dojo, wanting to know what Aikido is. Haydn Foster (you know, the guy who trained with Henry Ellis under Kenshiro Abe) gave his glowing endorsement of the book in the foreword.
One thing that came as a surprise was how closely the content followed my training syllabus: The set of foundational techniques in the book, their forms of application, and even the minor details in the illustrations, are identical. Just as we do, Bagot divided these into two categories: four immobilisation techiques, and the other five projection techniques. Also, though the book is about the traditional style of Aikido, it wasn’t dismissive of Ki and the mind-body unification thing that was introduced to us by Koichi Tohei. Bagot also briefly and impartially described the technical differences between his and other styles of the art without the usual politics.

The opening chapters assume the reader has no prior experience with the martial arts, and it introduces the reader to dojo etiquette and customs. Early in the book, the fundamentals are covered, such as relaxation, co-ordination, breakfalls, ‘blending’ (a training partner grabs your wrist and you feel for their centre). These are the essentials that junior grades will practice thousands of times before it becomes second nature.

Weapons Techniques
About 30 pages are dedicated to the bokken, following the style taught by the Iwama school. Bagot argues that sword practice is important for properly understanding the projection techniques. At my dojo we take the opposing view: One must be able to move naturally with relaxation and co-ordination, always, before we could start working on extending that control to a weapon – why waste valuable mat time waving a stick around? Our sword handling, movements and katas are used to refine techniques and to amplify deficiencies in co-ordination. Also, the overhead shomen uchi position, which seems to be common in Aiki-ken, has always puzzled me. Why would a swordsman leave his throat and the front of his body exposed to an opponent? Was that really taught by the Kashima Shinto-ryu?

Moving on… Another forty pages deal with the jo (basically a wooden staff), which, as Bagot pointed out, is notoriously difficult to master. Where we have one long kata, Bagot’s style has numerous shorter ones. Each movement should either be a strike or a defence that maintains the distance between the attacker and defender. In the defence techniques, it’s important to keep the opponent moving and get into the position to project from the end of the jo.

Real Aikido

Following that, there are two chapters on various forms of kokyu-nage and advanced techniques. As Bagot wrote: ‘The practice of kokyu nage is the closest that we come to touching the true spirit of Aikido. For the kokyu nage to be performed well, it is essential to achieve unification of mind and body, to blend with your partner and to breathe correctly and without haste‘.
If I recall correctly, ‘kokyu nage’ translates to English as ‘breath throw’, and the author argued that breath control is critical to pulling it off. Real Aikido is dynamic, with the practitioner striking the attacker to get the effect s/he wants before the wrist is grabbed, and the grab might be substituted for a punch. One of the reasons Aikido is often slagged off as a martial art is that techniques taught to junior students are confused with the defensive applications one develops from them. As a white belt, I wasn’t taught how 1st form ikkyo could be adapted to work against anything but a wrist grab. For someone who only trains a couple of hours per week, it’s a slow learning curve.
Also, history appears to suggest that Aikido was originally taught to to students who already had a foundation in other martal arts (especially Judo) , and were able to quickly assimilate Aiki.

I’ve probably digressed, but the above is relevant to the chapter on ‘kokyu nage’, because for us, ‘kokyu nage’ doesn’t refer to any technique, or any set of techniques. Rather, it’s a general term for a throw that’s performed after blending with an opponent’s movements. I even use that term (maybe incorrectly) for anything simple that ends with a throw, and often it’s something I’ve improvised. That’s what we should be doing, in applying the throws and joint locks instinctively, even combining them, with minimal movement or thought. For anyone using Aiki, wrist grabs can be substituted for straight and right-hook punches, and the techniques would still work.

Other Things

In the closing chapter, Aikido – The Modern Face, Bagot provides a brief description of three main styles that were established outdside the Aikikai – Ki Aikido, Yoshinkan and Tomiki Aikido. The bulk of this chapter is dedicated to the latter, probably because it differs the most from the traditional style, being adapted to competition and sport. Apparently in Tomiki Aikido there is more emphasis on randori – free-form practice – which develops the ability to react to attacks more quickly.

Appendix I is a section dealing with basic Japanese language, with a katakana character table and a ist of common phrases. Apparently, a basic understanding of Japanese is a requirement at certain dojos, and it’s a practice among some practitioners to wear a belt with their name embroidered on it – I’ve never encountered this myself.
Appendix II contains the grading syllabi for the kyu ranks. Again, the format and terminology are identical to what I’ve practiced, though only senior grades practice with weapons at our dojo.

Sometimes it’s our duty to question authority and take matters into our own hands


, , , , , ,

As horrific as the accounts in the Pennsylvania Grand Jury and the Independent Inquiry into Child Abuse reports are, it’s probable that the investigations exposed only the tip of a much bigger iceberg, and for us, likely the beginning of a very long crisis. Already the moral authority of the Church has been severely compromised, and many of us, myself included, have lost faith in the hierarchy.
We have yet to see a satisfactory response from the Vatican, which I could only imagine would be extremely frustrating for the victims, and Josh Shapiro’s presentation of the report might be taken as a plea for Catholics to hold the Church hierarchy accountable, because frankly it seems the Grand Jury has no other recourse. I also feel sorry for the many good priests and bishops, who dedicate their lives to being shepherds of our communities, but are unjustly treated with distrust and suspicion as a result of the scandals. I don’t think most of them were even aware of how insidious the cover-up was.
There’s been talk on the forums about putting together an organisation to counter the infiltration and exploitation of our Church by predators (I’ll come to this), to investigate and expose whatever crimes are still being hidden.

How could we fix the problem? Well, first we must be brutally, and even unpleasantly, honest about it. The first thing I noticed in the reports was the incidents and the cover-up were limited almost exclusively to networks, cliques, inner circles, etc. within the hierarchy. With very few exceptions, the ‘laity’, fraternities, sodalities and other community groups were absent in the accounts. Like the predators they were, the perpetrators targeted children when there was nobody around to protect them, usually at locations where they wouldn’t be observed by the public, and went to lengths to keep it hidden.
One implication of this is that a stronger and more active ‘lay’ community, similar to what you’d find in my diocese, where we insist on background checks and the ‘two-person rule’ for all positions of trust, would greatly mitigate the risks of this happening again.

The second thing I noticed was the complicity of those who knew what was happening, and this is something I’m really struggling to comprehend. Any normal person would have reported a perpetrator to the police and/or called for his lynching, if it became known that a disgusting, horrific and degrading act, common in what you’d read in the Pennsylvania report, was performed on a child. To do nothing would be indefensible, especially when the accusations are credible and there’s enough evidence to bring charges. Yet, the reports exposed numerous instances of the hierarchy deliberately and unambiguously protecting the perpetrators from justice and ensuring they remained in positions of trust. This cannot be dismissed as a ‘mistake’, a mere failure to act because moral courage was lacking, or even an attempt to protect reputations. Again, the Vatican isn’t being honest about this. We need to examine why they behaved that way.

Thirdly, I genuinely do believe the Church has been infiltrated by Satanists, because the worst cases in the reports involved acts of desecration that could only have been committed by someone with a malevolent and pathological hatred of the Catholic faith and contempt for human dignity. They were not the actions of someone who was religious but unsuited for the vocation, or incidentally had a sexual interest in young men. Again, I’m wondering why something this bad was covered up.

Secrecy and Blackmail

Somehow the perpetrators who infiltrated the Church developed networks that facilitated their actions and protected them from justice. How was this possible? The most plausible explanation I could find was published by psychotherapist and former priest, Richard Sipe, who made the following assertions:

II. Celibacy (sexual abstinence) is not a common or persistent practice among Roman Catholic clergy. Many bishops and priests have had or are having some kind of sexual contact, experience, or relationship, at least from time to time.
III. Sexually active clergy, and those with a sexual history, run the risk of exposing their own activity if they bring a fellow cleric‟s activity to public attention. A great deal of information about priests‟ sexual lives, however, is circulated within clerical circles and some can be found in church records. Sacramental confession is a reservoir of sexual knowledge.
‘VII. At times priests or seminary faculty are involved in sex-play or relationships with seminarians or young priests. Later the faculty member is promoted to the office of major superior or bishop. Even the good numbers of clergy who have been sexually involved and subsequently strive to establish celibate practice are caught in the circle of secrecy that covers even sexual abuse of minors. [There is no effective viable recourses to report misbehavior of a bishop.]’

I do not share the belief, common among the traditionalists and conservatives who tried to warn us, that homosexuality or gay priests were directly responsible. Sexual orientation alone does not degrade one’s character, and I find it difficult to believe that good men of faith, gay or not, somehow become predators after joining the priesthood. Rather, it seems the prevailing, and maybe unhealthy, attitude towards sexuality contributed to the problem.
The reality is that clergy are human, they’re held to standards that most men and women would find impossible, and some inevitably fail. Jesus knew this well, and even the Church fathers struggled with their own weaknesses. We also know this, because we hold celibacy outside marriage as an ideal, yet it’s an ideal that~95% of us cannot live up to. It would seem that the shame attached to failure had created a culture of secrecy and blackmail among the clergy, and this was exploited for the wrong reasons.

The vim Editor as a Developer Environment


, , , , , ,

Basic Keybindings

Perhaps the most basic and useful keybindings for modifying code relate to the copying/moving/pasting of code sections within a source file. To do this, use the ‘v‘ key in visual mode to mark the beginning and end of the section to be copied/moved, and press the ‘y‘ key to copy that section. The ‘p‘ key will paste the section wherever the cursor is positioned.

Line Numbers

A feature that’s pretty much universal to code editors is line numbering, obviously to make it easier to find something referenced by a debugger or an exception message. Either use the ‘:set number‘ command, or add it to vimrc.

Splitting Windows and Comparing Source Files

The easiest way to have multiple files open in a session is to use the ‘:tabedit [filename]‘ command, and use the ‘gt‘ keybinding to switch between tabs. If you’re using gVim, you can click on the tabs just like a conventional GUI editor.
Sometimes, though, we might want to display two source files simultaneously. Enter command mode, and use the ‘:split [filename]‘ command. e.g .’:split AD-Authentication-Model.cs‘. Another window will appear in the editor, with the content of the specified file.

We can switch between the windows using Ctrl+W. This works in both visual and insert mode. To close the current window, use the ‘:close‘ command (or even ‘:q‘).

There is a variation of this command that splits the window vertically, and you might find this more conducive for comparing files, especially with the line numbers displayed.

Replace the ‘:split‘ command with ‘:diffsplit [filename]‘ to compare a file with an earlier version of itself.

For copying/moving sections between windows, ‘dp‘ shifts a selected block from the current window to another, and ‘do‘ fetches a block from another window into the current one.

Folding Code Sections

Using ‘zf‘ and ‘zo‘, we can hide marked sections of code, to make a source file easier to read. This is done in visual mode, not command mode. Here we have two methods displayed in the editor, and we’ll fold them so they’re represented by single lines.

Use the ‘Esc‘ key to enter visual mode, and ‘v‘ key to highlight the section of code to fold, and then ‘zf‘ to fold the highlighted section. Here I’ve done this with two methods.

After using ‘zf‘ to fold marked sections of text, we should use ‘zc‘ to close and ‘zo‘ to open. This is important if there are folded sections nested within other folded sections.

Omni Completion

This is vim’s equivalent of Visual Studio’s IntelliSense. Use Ctrl+N before, or Ctrl+P just after, the keyword in Insert mode. My installation doesn’t appear to list the autocomplete options specific to the current programming/scripting language.

Browsing the Filesystem

The editor could be made to have a layout rather like Visual Studio, with a file browser displayed in one of the windows. Here I’ve used ‘:Vex‘ to open vim’s own file browser. This will create a new window in the browser automatically.

To open a file, move the cursor to the file name and press the Enter key.

Semi-GUI Menu

source $VIMRUNTIME/menu.vim
set wildmenu
set cpo-=<
set wcm=
map :emenu

Now, when the F4 key is pressed in the editor, a semi-graphical menu will be displayed along the footer of the window.

Errors Window

When compiling a source file, use the ‘:copen‘ command to open a window listing errors, and ‘:cclose‘ to close it.