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.… Continue reading
- BD-ROM / DVD-ROM
- Large Hard Drive (mine is 2 TB)
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.… Continue reading
- Receiver (optional)
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:
- Use the link above to obtain and install PS3 Media Server on the PC you’re using as your media server.
- Turn on your PS3.
- 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.
- Under the “Navigation/Share Settings” tab, add any folders you want to share with your media renderers under the “Shared folders” section.
- 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.
- 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.… Continue reading
Here is a link to the article I wrote on Medical Simulation in Wikipedia about a year ago: http://en.wikipedia.org/wiki/Medical_simulation… Continue reading
You may have noticed that this post is about two months late. Time flies, doesn’t it? The previous post on an introduction to web services and how they work with ASP.NET provided you with a cursory glance. This post will provide you will how to implement a very basic web service both on the server side for consumption and the client side for use in an application.
- Visual Studio 2005 or 2008
- Basic knowledge of C#
- Basic knowledge of ASP.NET Web Services
Step 1 – Create the ASP.NET Web Service
- Visual Studio –> File –> New –> Project… –> Visual C# –> Web –> ASP.NET Web Service Application
Once the web service application project is created, notice that a templated web service was also created (Service1.asmx). The only section of this template to be worried about at the moment is the HelloWorld method marked with the [WebMethod] attribute. Marking methods as a [WebMethod] identifies that they will be used by an external caller through XML SOAP communication and are required to be exposed by the web service WSDL described in the previous post.
- Make sure the HelloWorld method looks exactly like below.
public String HelloWorld()
return "Hello World";
- That is literally all it takes to expose a web service method to the world! Press F5 to begin debugging this application in a local web server and continue to Step 2.
… Continue reading
NOTE: Microsoft no longer suggests using this method of web services, but it is useful knowledge if you are supporting legacy systems or are still required to implement these features for business purposes. This method of web service is still useful for internal operations that do not require high security.
Below is an overview image of common web service architectures. It’s easiest to think of web services at “web methods” contained within a “web library” that contains methods to be executed on a server. The strength of this approach is that all communication is done in a standard XML format, regardless of the platforms communicating. This allows for brand new systems to communicate with extremely legacy systems, assuming that each system can properly implement a valid SOAP request and response according to the WSDL contract.
Client: Any application that requires consumption of whatever methods the web service is exposing.
Web Server: A process that hosts the web services for consumption.
Broker: Provides the definition of the web services being exposed.
SOAP: XML formatted request and results containing data according to the WSDL (see below.)
WSDL: Definition language describing which method to execute, what parameters the method requires, what data types the parameters are, what results will be returned from the web service, and what data type to expect back from the web service.
A common SOAP request with a body but no header. Note that the method being executed is defined in the <m:GetStockPrice> tag and the parameters passed are described in the <m:StockName> tag.… Continue reading
I started out in professional web development by using ASP.NET, so I was spoiled by the fact that Microsoft offers a SqlConnection class to use for various database related connectivity features. When I started with PHP, I decided to do some research and write a similar (albeit, much simpler) Connection class. Keep in mind that this class example only supports MySQL.
I started by defining some members of this class and came up with six useful members.
- Database connection object returned from mysql_connect
- Boolean to determine if the connection is currently open or closed
- Database server host name
- Database catalog name
- Database user
- Database password
public $dbConnection = null;
public $isConnectionActive = false;
private $dbServer = null;
private $dbCatalog = null;
private $dbUser = null;
private $dbPassword = null;
In order to use this class, we need to add a constructor. I began by creating a default constructor that simply initializes values of the member properties. Take notice that not all of the properties are initialized by the default constructor. $dbConnection is not initialized until the Open() method is called and $isConnectionAlive is already false by default.
public function Connection($server, $database, $username, $password)
$this->dbServer = $server;
$this->dbCatalog = $database;
$this->dbUser = $username;
$this->dbPassword = $password;
Now that the class can be instantiated, we need to add methods to allow operations.… Continue reading
If you’re used to classes with C#, C++, and Java, then you’re used to classes in PHP as well. If you’re brand new to classes, I suggest you read up on the definition and uses of them before trying to implement them via this tiny tutorial.
To begin, let’s create a simple class that will store information about a logged in user from a session. This class should hold the user’s username, first name, and last name to identify who it is on subsequent pages and requests. Begin by naming this class as “UserPassport” and adding the three previously described properties. They should not have default values because the class does not make sense without properties assigned during construction.
Expanding on this class, we need to add a constructor and a method to use these properties in a semi-meaningful manner.
public function UserPassport($uName, $fName, $lName)
$this->userName = $uName;
$this->firstName = $fName;
$this->lastName = $lName;
public function displayInfo()
$userInfo = array($this->userName, $this->firstName, $this->lastName);
echo implode(', ', $userInfo);
There’s nothing crazy going on in the constructor.… Continue reading
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.… Continue reading
I wrote the code found in this post in the Student Version of MATLAB R2009a (184.108.40.2067) 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
% 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.… Continue reading