Skip to content

I have finally started uploading apps to the Android app store. The three apps I previously wrote about (Scientific Name Search, Plasmatic and Dutch Public Holidays) are uploaded to the app store, as well as a few apps I created based on a version of my astronomical library ported to Java.

The crowning glory of these astronomical apps I have uploaded to the app store is Night Sky Tools (http://play.google.com/store/apps/details?id=com.smeunier.nightskytools).

The features included in the app are:

  • Angular separation
  • Astronomical Time
  • Atmospheric refraction
  • Coordinate convertor
  • Eclipses
  • Magnitude
  • Precession
  • Conjunctions and Oppositions
  • Ephemerides of the planets, sun and moon
  • Equinoxes
  • Positions of Jupiter’s moons
  • Planetary orbits
  • Constellations
  • Stellar Classification
  • Telescope Airy Disc
  • Telescope F-Ratio
  • Telescope Magnification

Go ahead and check out the app.

Share

Spirals are a relatively easy shape to draw, but in order to draw a good spiral we need a bit of simple trigonometry.

The basics of the spiral are the radius of a particular point from the origin, at a particular angle, and for the code below, the radius increases as the angle increases. The exact relation between angle and radius determines the type of spiral.

In the simplest case, the radius will increase linearly with the angle, thus
Radius = Angle * ScalingFactor

We can also use quadratic or cubic equations to define the realtionship
Radius = Angle2 * ScalingFactor
Radius = Angle3 * ScalingFactor

The most interesting spiral, however, is the exponential spiral, which is found in nature most famously in the nautilus shell.
Radius = Anglee * ScalingFactor

Now that you can determine the relationship between radius and angle, it is a simple matter to draw the spiral.

Starting at the origin, with angle 0, we need to increment the angle by a certain amount – in the code below by 0.5 degrees per iteration – and then calculate the radius, and then using the radius and the angle, we are able to calculate the x and y coordinates of the point by using simple trigonometry, since sin(angle) = y/r and cos(angle) = x/r.

Now after finding the coordinates of the point, we simply need to draw a line segment from our previous point to the new point. The smaller the angle increment, the smoother the curve which is drawn will be, but it also means that more points need to be calculated to draw the same curve, which consumes more processing time.

One good way of speeding up the calcution of the curve, is to use a lookup table for the cos and sin values instead of calculating them with each iteration, but that is a topic for another post.

      public void drawSpiral(double scale, double delta, double revolutions, int centreX, int centreY, SpiralType spiralType, int width, int height, Color color, Graphics g)
      {
         Pen p = new Pen(Color.Blue, 1);

         double prevX = centreX;
         double prevY = centreY;
         double X = centreX;
         double Y = centreY;
         double theta = 0;
         double radius = 0;

         while (theta <= (revolutions * 360))
         {
            theta += delta;
            if (spiralType == SpiralType.Linear)
            {
               radius = theta * scale;
            }
            else if (spiralType == SpiralType.Quadratic)
            {
               radius = theta * theta * scale;
            }
            else if (spiralType == SpiralType.Cubic)
            {
               radius = theta * theta * theta * scale;
            }
            else if (spiralType == SpiralType.Exponential)
            {
               radius = (Math.Pow(theta / 180 * Math.PI, Math.E)) * scale;
            }

            prevX = X;
            prevY = Y;
            X = (radius * Math.Cos(theta / 180 * Math.PI)) + centreX;
            Y = (radius * Math.Sin(theta / 180 * Math.PI)) + centreY;
            g.DrawLine(p, (float)prevX, (float)prevY, (float)X, (float)Y);
         }

      }

      public enum SpiralType
      {
         Linear,
         Quadratic,
         Cubic,
         Exponential
      }
Share

Recently I decided to experiment a bit more with developing Android applications. I had played around with Android a rather long while ago, creating two rather simple apps – Dutch Public Holidays and Plasmatic, but decided to look at it again.

I have improved upon my two previous apps, making them much more useful, and created a third app, using webservices to look up animal and plant scientific names.

Thanks to the thousands of Android tutorials littering the web, it is not hard at all to get started in Android development, and the integrated Eclipse/Android SDK makes for a very pleasurable development environment.

Since there is nothing that can’t be found in other tutorials in the applications, I won’t list the code for the apps themselves, but you can download the source code for the apps from the links below.

Dutch Public Holidays
This was the first app I wrote, and is rather very simple in construction. It merely shows a list of public holidays for the Netherlands for a particular year.
InstallerSource

Plasmatic
I ported some code from my C# fractal library I had written a while back to Java to draw plasma fractals. The application generates a plasma fractal based on a set of preferences, and is able to save the generated images to a file on the mobile device.
InstallerSource

Scientific Name Search
This app makes use of a webservice provided by www.itis.gov to search for information such as the scientific name and taxonimic classification of plants and animals.
InstallerSource

Share

Picture the scene. You have spent all afternoon trying to figure out how to install a must-have app onto your smartphone, but get nowhere.

With defeat unhappily accepted, you jump onto Google to search for help. The results arrive milliseconds later promising to aid you in your quest, only to find that instead of finding a nice explanation of what to do, you are instead confronted with some stranger prattling on for 10 minutes in a YouTube video telling you how it should be done.

This scenario is not too bad if there are lots of regular text-based tutorials or webpages telling you what you need to know, since then you can just ignore the videos, but it gets really frustrating if there are no other results, and you are forced to sit through the agony of listening to this self-important guy drone on and on.

Video tutorials are very useful for practical demononstration of what they are talking about that. I think those are a great idea, and serve a purpose, so I not saying all video tutorials are a bad idea. It is just the ones that show a guy talking for however long you have to endure the video that add no value, so for anyone thinking of posting a video tutorial, here are the pros and cons to consider

Pros

  • Great for demonstrations (doesn’t count if you are just standing there talking)
  • Useful for people with nothing better to do

Cons

  • Take up a LOT more bandwidth than text tutorials (important especially for smartphone users)
  • Takes longer to find info you are looking for – you need to listen through the entire thing, including all the rambling. A text tutorial can be skimmed through
  • Difficult to jump around like in a text tutorial where you can refer to any part at any time.
  • Written text is often easier to understand than spoken text, especially for second-language speakers
  • Do you really think that people want to listen to your voice?

So, in conclusion, unless you think it could actually add value over a simple text tutorial, please don’t post a video tutorial. Write it down instead!

Share

I recently joined a group on Facebook that shares interesting music videos, and that got me thinking about the music of my youth.

Most kids (at least those that I have met) tend to rebel against their parents musical tastes, forging a personal sound from their social groups and media surrounding them, but I was somehow different. My core musical taste came directly from both my parents. Outside influences came a distinct second.

Now don’t get me wrong, I still loved the music around me growing up. I listened to Roxette, Bon Jovi, Queen, Michael Jackson and many more of the (then) current bands, but the music that truly defined me came from an earlier period.

I had just become a teenager when the 90′s started, but my musical taste was stuck in the 60′s, 70′s and 80′s, and not to mention classical, thanks in a very large part to my parents. I remember spending hours playing with my father’s hi-fi, and the sounds of Glenn Miller, Laura Branigan, Beach Boys, Traveling Wilbury’s and the soundtrack to Caravans are forever etched into my mind.

I also remember listening to Wham in a mix tape my mother had in her car when I was six years old.

When my father passed away in 2004 (already 8 years ago – I can remember it like yesterday), I found his collection of tapes in his estate, and for the next year, the only thing that played in my car’s tape player (yes, my car had one of those even in 2004), was these old tapes which my father adored.

My father and I never really got on very well, with some periods where I barely saw him for months or years at a time, but I did share his love for his music, counting those bands I had listened to on that hi-fi as among my favourites.

I miss him terribly sometimes, especially when I have those songs on…

Share

Much to my shame, I first came across a feature of web-browsers that had been developed way back in 2001 – the bookmarklet.

What a bookmarklet is, is a regular browser bookmark that has a piece of javascript for its address instead of the usual url, by using the javascript: prefix instead of the usual http: or http:. I had known for a long time that the address bar of most browsers support this, but did not even think that this functionality extended to bookmarks.

What this means though, is that you are able to insert almost any imaginable script into a bookmark.

Here is an example, which I found on the Wikipedia page on bookmarklets, which opens up the relevant Wikipedia article based on the selected text within your current document, which can be a great timesaver.

javascript:function se(d) {return d.selection ? d.selection.createRange().text : d.getSelection()} s = se(document); for (i=0; i<frames.length && !s; i++) s = se(frames[i].document); if (!s || s=='') s = prompt('Enter%20search%20terms%20for%20Wikipedia',''); open('http://en.wikipedia.org' + (s ? '/w/index.php?title=Special:Search&search=' + encodeURIComponent(s) : '')).focus();
Share

Having recently created an account on Audible.com, I have been trying to find interesting titles to add to my library.

As most people would probably agree, it is always nice to get something for free, so I was rather eager to try out a suggestion I read in a Lifehacker article on how to use Google to search for free audiobooks on the audible site.

It is dreadfully simple. Simply enter the following search query into Google, and you get scores of results:

$0.00 -Excerpt -Interview -Chapter -Extract -Speech -Sample -"A Conversation" -"This is Audible" site:audible.com

It can also be modified to suite exactly what you are looking for.

One additional thing I did do though, is to use this query to create a Google Alert, so that whenever a new free title gets picked up by Google, I will be immediately notified, allowing me to take advantage.

How often I will get that alert is something that only time will tell now…

Share