Introducing the Dota Database

I’ve spent some recent weeks building a cool new web site which exposes a lot of Dota 2 game data which may not be easily accessible to most players. You might be thinking, but I already use DotaBuff for all my Dota 2 needs! DotaBuff is great, but it doesn’t cover everything.

For starters, the new Dota Database that I’ve created is useful to see some of the finer details regarding heroes, hero abilities, items, item abilities, cosmetic items for purchase in the store, and more. This includes details like spell and ability behaviors, which shops you can purchase an in game item, hero level progressions, cosmetic item sets, and even pro player autographs. The information for these specifics comes directly from the game files and the Valve provided Dota 2 web APIs.

Live League Game Listing

This page will give you a paged listing of all currently live league games. Some games will display blank data when still in the hero picks/bans phase. Each listing shows the league, the team names, elapsed times, spectator counts, series scores, team scores, player scores, player picks, team worth, and team XP. Click in to the listing to see all the live updated details for the match.

See it in action

LiveLeagueGame

Live League Game Details

When you click in to a live league game, you’ll see a page full of information about that game. Every 20 seconds, the page will refresh and show you the latest updates about the match. All data is provided by Valve through its Dota 2 league web API.… Continue reading

Object-Oriented Connection Class in PHP

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

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.

Now that the class can be instantiated, we need to add methods to allow operations.… Continue reading

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.

p1formula

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

p1formula_s

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:
step1

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

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

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.
step4

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