Category: Miscellaneous

The Fallacy of the Genius Billionaire

There are few things in life more insufferable than an opinionated and ill-informed spectator with a planet-sized megaphone. Such a person and their tool alone is not enough to cause a problem other than mere annoyance. With the addition of a bucket of money, a dash of ego, and a following of loyal acolytes, the severity of annoyance quickly accelerates beyond the escape velocity of Earth.

Such is life in 2020. A year in which nearly everyone has vast amounts of quality information quite literally at the tips of their fingers and, instead of using it to reduce their ignorance, dismiss the inconvenient or disagreeable portions in favor of the deranged rantings of followed celebrities.

Consider someone like Elon Musk. He has been and is the founder and head of some successful and, frankly, impressive technologies. The notches on his belt list off behemoths such as PayPal, Tesla, and SpaceX. The reasons for the successes of these companies can certainly be debated, but what is certain is that Musk has been involved with all of them.

Now consider the strange musings that ooze from his Twitter profile. It takes merely one brief visit before you’re swimming in nonsensical posts, cult like worship, endless whataboutisms, links to anecdotal clickbait, and people relentlessly screaming past each other. While that type of behavior isn’t unique to Musk, the combination of his past successes, the money that came with those successes, and his appeal to entrepreneurs has allowed him to build a near impenetrable following of zealots that hang on his every word.

And therein lies the problem. Cult and celebrity worship inevitably leads credulous individuals to throw their support behind nearly everything the cult or celebrity does.

There is a tactic employed by propaganda outlets that allows them to get started and build an audience from among a sea of activity.

It begins by operating a run-of-the-mill operation in which “normal” information is released to potential followers. An article from the New York Times here, a video from Bloomberg there, and a well-researched paper from the journal Nature over there. Over a period time, a following accelerates, builds, and begins participating and responding to the activity of the outlet.

A healthy following demands progress into the next phase of propaganda. This period is marked by a transition from informed authors to the sharing of more fringe resources. Such a transition does not happen immediately, as followers would be repelled and seek a different outlet that more aligns with their worldview. Instead, the outlet slips a few fringe articles in with the more mainstream articles. Since the outlet has built trust with their audience, such outliers are less repulsive to the followers. After all, the followers have spent a considerable amount of their time listening to an outlet that they have come to trust. Why would they turn their back on something that has regularly provided them with good information? Surely all future data has been as thoroughly vetted as in the past, right?

It is at this moment that the outlet swoops in for the coup de grâce.… Read more

Forced Attention

Stone statues salute silently while lookers at and passers by cheer.
Gusty gales cause commotion to the dismay of those most near.
Resulting rumbles snap onlookers from a trance when statutes fall.
Frustration forces former followers to point, sneer, and jeer. Up! Get tall!
While considered nothing down below, they are even less when left in tow.
Read more

Blu-Ray Containers, Video/Audio Codecs, and Subtitles

In the previous couple of posts, I described some short techniques to accomplishing a simple media server using your legally purchased Blu-Ray and DVD movies. If you are anything like me, you will most likely start getting confused when you look at MakeMKV and Handbrakes more advanced features such as which video/audio codecs to use. You may even run into some crazy streaming playback anomalies regarding TrueHD 7.1 and PGS subtitles like I did. Well, I do not have all the answers for you, but I can at least give you a little bit of information and allow you to take solace in the fact that someone else out there is experiencing similar problems!

Please note that these lists of containers and codecs is not comprehensive. I have chosen commonly found files and formats for convenience and brevity.

Media Container Formats

A lot of people get confused about the differences between all the slang, acronyms, terminologies, and file formats that get tossed around on forums and blogs. Trust me, I know that it can be confusing when someone says something like, “Oh, it’s easy, just create a .mkv, and encode the video with x.264 and the audio in AC-3.” If you have no prior knowledge of these terms, you will be more than a little bit confused.

The bottom line is that there are four common components to movie media files: containers, video tracks, audio tracks, and subtitle tracks. Containers do exactly what you would guess: they contain the rest of the content. When you see a .avi file, that’s a movie file using the AVI container format. It contains video tracks, audio tracks, and possibly subtitle tracks.

See the following for a comparison between different containers:

  • .m2ts – Non-open format commonly found in Blu-Ray discs and AVHCD. You’ll find this format when you rip a Blu-Ray using straight Blu-Ray copy software like DVDFab. This format supports menus that are commonly found on Blu-Ray discs.
  • .mkv – Open source, widely supported container that can support an unlimited amount of any video, audio, and subtitle tracks.
  • .avi – Microsoft developed container developed in the early 90s with too many limitations to list here. There is no reason to use this container over .mkv.
  • .mp4 – Widely supported container based on the MPEG-4 standard with similar capabilities as .mkv. There are some limitations as to which video and audio codecs it will accept, but most of the more common codecs are supported.

My recommendation for most movies that you rip: MKV

Video Codecs

Contained within a file, video codecs determine the quality and other attributes of a video track. For the most part, you are going to run into H.264 and VC-1 when dealing with Blu-Rays and MPEG-2 when dealing with DVDs.

See the following for a comparison between different video codecs:

  • H.264 – The most commonly used high definition video compression codec used in Blu-Rays (players must support H.264), YouTube, iTunes, Flash Player, Silverlight, and various media broadcasts.
Read more

Ripping Blu-Rays and DVDs to a Media Server

Hardware needed:

  • PC
  • Large Hard Drive (mine is 2 TB)

Software needed:

Media is increasingly migrating towards streaming-only distribution. Discs, even BD/HD-DVD formats, have rather low limits on the amount of data that can be stored on each. These low limits and the increasing availability of high-speed and high-bandwidth internet connections are just two reasons that consumers have begun to rely on streaming digital content including movies, music, videos, and pictures. The convenience of streaming services like Netflix and Hulu allow consumers to avoid commercials and watch what they want and when they want. Products like DVR and TiVo are only band-aids on top of the real problem: cable companies disallowing customers to choose their own content at convenient times.

Just think about what you have to do in order to watch your DVDs and Blu-Rays. I have Blu-Rays in my possession that literally take 5 minutes just to load the main menu. This problem is magnified by useless services like BD-Live that require internet connectivity in order to load content like chat rooms and trailers that users may never even use. For users like me, I want to be able to access my content immediately and in the format of my choosing. The current implementation of HD media inconveniences consumers by disallowing various viewing options and restricting Blu-Rays to only existing on the original disc. In fact, the legality of copying  Blu-Rays for personal use even when creating simple backups is questionable because of the insane policies of the MPAA and the legislative pockets that they influence.

Unless you’re sharing and distributing your backups, I sincerely doubt any authority is going to care. The MPAA and other organizations that rely on Blu-Ray sales isn’t losing a single penny if you backup your physical media. You’ve already legally purchased the disc and are simply transferring the contents to a device of your choosing. Continue at your own discretion and follow these steps. Keep in mind that MakeMKV is not going to perform any transcoding of your content. The original video/audio codecs will be left untouched and will simply be transferred to a .mkv container.

  1. Download and install MakeMKV from the link above.
  2. Download and install Handbrake from the link above. (optional)
  3. Download and install VLC Player from the link above. (optional)
  4. Start up MakeMKV.
  5. Insert the DVD or Blu-Ray of your choice into your BD-ROM/DVD-ROM drive.
  6. Wait for MakeMKV to scan the disc and then click the big Disc –> HDD icon.
  7. Wait for MakeMKV to scan for titles, video, audio, and subtitles.
  8. Check and uncheck the desired contents to be included in the final .mkv output file. (I will write another post about specifics on video/audio codecs and subtitles.)
  9. Change the output path in the right panel and click the button to the right of the output path.
  10. Wait for MakeMKV to complete the process and transfer the final output to the shared folder of your media server.
Read more

Creating a Media Server using PS3 Media Server and a PS3

Hardware needed:

  • PC
  • PS3
  • TV
  • Switch
  • Receiver (optional)

Software needed:

Ideally your setup will look something like: PC (media server) –> Switch –> PS3 –> Receiver (optional) –> TV. The advantages of including a receiver between the PS3 and the TV include better speakers and the ability to decode some of the newer proprietary audio codecs such as DTS-HD and TrueHD (more on that in a different post.)

Follow these steps:

  1. Use the link above to obtain and install PS3 Media Server on the PC you’re using as your media server.
  2. Turn on your PS3.
  3. Start up PS3 Media Server and wait for it to scan the network for available renderers. When it’s done, you should see your PS3 in the “Detected media renderers” section. You can confirm connections or view any errors in the “Traces” tab.
  4. Under the “Navigation/Share Settings” tab, add any folders you want to share with your media renderers under the “Shared folders” section.
  5. On the PS3 menu, go to the appropriate section that you want to stream under (Pictures, Music, or Video), find the PS3 Media Server, and navigate to the content you want to stream.
  6. When you start streaming, PS3 Media Server will display information about what it is currently streaming, the buffer status, and the bitrate under the “Status” tab.

Quite honestly, this is all that needed to be done to get content streaming properly to my TV. In a separate post, I’ll talk about some of the more advanced options of PS3 Media Server, transcoding, video/audio codecs, subtitles, ripping Blu-Rays/DVDs, and lessons learned for the best streaming performance.… Read more

Solving a Simple ODE with Simulink

If you have just started learning Simulink, one of the easiest tasks is solving a simple ordinary differential equation. In fact, most of the beginning guides you will find through web searches will probably be similar to the example I am going to provide. Let’s start by assuming you have the following common spring-damper system. For reference, m is mass, c is the damper coefficient, k is the spring coefficient, x is the position, x-prime is the velocity, x-double-prime is the acceleration, and f(t) is a step-input function with a magnitude of 3.


We begin first by solving for the second derivative of x. In this case, it ends up solving to:


Now, it is time to place this into Simulink using the following blocks:

  • 2 integrator blocks
  • 3 gain blocks
  • 1 sum block
  • 1 step input block
  • 1 scope output block

Step 1) Connect two integrator blocks together to simulate a double integration as seen below:

Step 2) Add the appropriate gain blocks to simulate c*x’ and kx.

Step 3) Add the sum block to simulate f(t) – cx’ – kx.

Step 4) Add the gain block after the summation to simulate the multiplication of (1 / m) and the step input function as the third input to the sum block added in Step 3. Make sure the step input function has the properties of Step Time = 0, Initial Value = 0, Final Value = 3.

Step 5) Add the scope block for output after the second integration to view the plotted contents of the numerical solution.

Using the following values for variables and initial conditions, you should see the plotted results as follows:
x(0)=0, x’(0)=0, x”(0)=0, m=0.25, c=0.5, k=1
resultsRead more

Generating Pseudo Random Numbers in MATLAB

I wrote the code found in this post in the Student Version of MATLAB R2009a ( on Windows Vista SP2.

function U = js_randv(i, x)
%js_randv Pseudo Random Number Vector Generator
% Returns a pseudo random number vector
% according to congruential random number generator
%   i = length of vector
%   x = seed value of sequence
%   U = vector of Xi+1 = (a * Xi) mod m

isFirst = 0;

a = 16807;          % 7^5 predetermined multiplicative value
m = 2147483647;     % 2^31-1 predetermined prime number
r = 2836;           % m div a
q = 127773;         % m mod a
T = zeros(1, i);    % holds seed values
U = zeros(1, i);    % holds returned uniform random numbers in (0,1)

% loop through all indices of vector
for j=1:i
    % if this is the first value, use seed
    if isFirst == 0
        seed = (a * mod(x, q)) - (r * (x / q));
        T(1, j) = seed;
        isFirst = 1;
    % if this is not the first value, use current index
        previousValue = T(1, j-1);
        seed = (a * mod(previousValue, q)) - (r * (previousValue / q));
        T(1, j) = seed;

	U(1, j) = seed / m;

This function will return a vector of size i containing randomly generated numbers uniformly distributed between 0 and 1. It’s not perfect, but it got the job done. I’ll get around to explaining it more beyond the meager comments another time.

Generating Random Numbers
Linear congruential generatorRead more