Skip to content

Technikal Mind

Technical thoughts from a Curious Thinker

  • Home
  • About
  • GitHub
  • Curious Thinker Media

Category: Programming

Building a Media Player using Vlc.DotNet, vlclib and WPF

Posted on September 6, 2016 - May 27, 2022 by technik

So for the last couple of days, I’ve been working on a Media Player project written in C# and WPF using Vlc.DotNet, a .NET control and wrapper for the VLC libraries.

Unfortunately, the documentation is rather sparse, so I’ve been trying to piece a few things together. If I get far enough into understanding it, I may consider contributing to the documentation.

My first issue was with getting the XAML control and the code-behind to work properly. I ended up realizing that the control is looking for the VLC libraries, so I had to define where they were located:

VlcControl.MediaPlayer.VlcLibDirectory = new DirectoryInfo(LIBVLC_PATH_DEFAULT_AMD64);

(Note: LIBVLC_PATH_DEFAULT_AMD64 is a private const string that is initialized outside of MainWindow() which holds the string value. In the future, I will expand this to determine whether to use x86 or x64 libs. For now, it’s using an explicitly defined path)

This passes a DirectoryInfo instance to the VlcLibDirectory property so that it can initialize in the next line:

VlcControl.MediaPlayer.EndInit();

Both of these are inside of a try-catch block, as they can throw a variety of exceptions, notably ArgumentException, DirectoryNotFoundException, and FileNotFoundException. At the moment, if one is detected, a MessageBox appears to notify us of the error, then the program gracefully closes.

I’m still exploring the code for the Vlc.DotNet project. I’ll have more to write in a follow up post.

Posted in C#/.NET, Computer Science, Development, Programming

Computationally Calculating Pi [in python]

Posted on March 16, 2016 - May 27, 2022 by technik

In honor of Pi day (3/14) and my increased fascination with mathematics as a whole, I decided to look under the hood and understand how the value of pi is calculated to be 3.14159… and write a program to do it.

Introducing: Pi-Py. Keep reading to learn more about the underlying process!

As it turns out, there are a number of approaches mathematicians have taken. For now, I chose to work with two methods: the Gregory-Leibniz series and the Nilakantha series. Here’s how they work.


Gregory-Leibniz

This method can accurately calculate \pi to 5 decimal places after approximately 450,000 iterations. That’s a lot!

Using sigma notation:

    \[ \sum\limits_{i=0}^\infty \frac{(-1)^n}{2n+1} = \frac{\pi}{4} \]

This is basically fancy notation for a loop – a summation.

In this case, i=0 is the initial value, \infty is the number of iterations, and \frac{(-1)^n}{2n+1} is the body of the loop.

Another way of representing this, which is perhaps easier to understand more directly, is as follows:

    \[ 4 - \frac{4}{3} + \frac{4}{5} - \frac{4}{7} + \frac{4}{9} - ... = \pi \]

(Note: I multiplied each number by 4 to get the value of \pi rather than \frac{\pi}{4})

This can be easily computed in a loop by alternating addition and subtraction of odd numbers. View the code on GitHub to see how this was implemented!


Nilakantha

This method is considerably faster – by about 10,000 times, as a matter of fact. After only 45 iterations, \pi&s=0&bg=00090a&fg=ffffff can be calculated to the same 5 decimal places as the Gregory-Leibniz method.

In the 15th Century, Indian astronomer/mathematician Nilakantha Somayaji published the following infinite series:

    \[ 3 + \frac{4}{2\times3\times4} - \frac{4}{4\times5\times6} + \frac{4}{6\times7\times8} - \frac{4}{8\times9\times10} + ... = \pi \]

As the denominator value changes incrementally, this too can be easily computed using a simple loop.

View the code on GitHub to see how I implemented the Nilakantha infinite series!

The Nilakantha method converges at a much faster rate than the Gregory-Leibniz method, but there are even faster series which I have not yet studied or attempted to implement as life has kept me busy! Nevertheless, it has been an interesting journey, and I’ll be posting about other projects soon.

As a side-note, I had the chance to learn some LaTeX syntax as a result of writing this article, which really helped to make the material look presentable.

Posted in Computer Science, Mathematics, Programming

Contribution to an open source project

Posted on November 4, 2015 - May 27, 2022 by technik

Today I made my first contribution to an open-source project on GitHub. The project is a Firefox port of the Tabs Outliner extension for Chrome.

So far, I’ve learned about Mozilla’s Jetpack project which is used for developing addons for Firefox. There are a number of SDK features available to manipulate tabs, the window, the application, reacting to browser events, etc. I will continue working on the extension when possible, but I’m also balancing a couple of other personal projects and classes as well.

Anyway, that’s it for this update!

Posted in Development, Programming

Starting Computer Science program

Posted on August 23, 2015 - May 27, 2022 by technik

The time has finally arrived. Tomorrow, I finally begin my Computer Science program. I’ve spent a considerable amount of time this summer studying CS-related topics, diving into data structures and algorithms (which happens to be one of my first CS classes this semester), practicing coding, as well as brushing up on mathematics.

This semester, in addition to the DS & Algorithms, I’ll have a Database Concepts class as well. I’ve had some exposure to it from my AAS degree, but the material appears to go a bit more in depth. The other classes are general education requirements: precalculus and intro to sociology.

Being that I’m a little bit older than most students, and having actual work experience (in the IT field), I feel as though I will have a different perspective on the program than most. Either way, I’m looking forward to meeting and networking with new people, and excited to start.

Posted in Computer Science, Education, Programming

Unity Game Development

Posted on July 1, 2015 - May 27, 2022 by technik

So I like to dabble with new concepts and technologies. I consider myself a “T-learner.” Learn about a wide variety of things, and dig deep in a few. This applies to knowledge and wisdom in general, but also to programming. I think it’s important to try a wide variety of things to find something you enjoy. Plus, I find it helps cement things – I learn by making connections, so seeing an abstract concept apply across different areas is helpful.

About a month ago I was wrapping up a web-based project, then I moved on to tinkering with Android Studio. Last week, I attended a Unity Game Development meetup with a friend and was intrigued to learn more. Now I’m taking some time to learn the Unity game engine.

There’s a lot to learn, and I’m mostly sticking to the official tutorials for now. In the meantime, I’ve been brainstorming various ideas for games I’d like to build.

Posted in GameDev, Programming

Igpay Atinlay Anslatortray [Python]

Posted on April 20, 2015 - May 27, 2022 by technik

I’ve been working on a small pig-latin translator project in python lately – which you can view on GitHub. It accepts input from the user (supports full sentences, as well), and parses each individual word. If the word begins with a vowel, “way” is appended; alternately, the first consonant(s) are shifted to the end with “ay” appended.

For example:
“arm” -> “armway”
“leg” -> “eglay”

It’s a relatively short script, but was a fun little puzzle to work on this past weekend. Once again, you can view the source for Igpay Atinlay Anslatortray GitHub.

Posted in Programming

JavaScript and friends

Posted on February 10, 2015 - May 27, 2022 by technik

I’ve been working my way through the JavaScript track on Codecademy for the last several days and have learned quite a bit.

Although I’m already somewhat familiar with OOP from taking Java as an elective in college, it has been a while so it was a nice refresher. In all honesty, it’s like riding a bike. I was a little wobbly at first, but after a few minutes it came back to me.

On another note, I’ve also been hacking away at a small project intended to help me learn a few new things. For instance, JavaScript itself, JSON, jQuery, node.js, Cordova and MongoDB to name a few. I don’t necessarily know that I’ll need to use all of them, but as of right now those are the items I expect to use.

And as a last note, I plan on developing a portfolio section with some of my work.

Posted in Education, Programming

Recent Posts

  • Building a Media Player using Vlc.DotNet, vlclib and WPF
  • Computationally Calculating Pi [in python]
  • Contribution to an open source project
  • Starting Computer Science program
  • Unity Game Development

Recent Comments

    Archives

    • September 2016
    • March 2016
    • November 2015
    • August 2015
    • July 2015
    • June 2015
    • April 2015
    • February 2015
    • January 2015
    • November 2014
    • August 2014
    • May 2013

    Categories

    • C#/.NET
    • Computer Science
    • Development
    • Education
    • Electronics
    • GameDev
    • Linux
    • Mathematics
    • Networking
    • Philosophy
    • Programming
    • Science
    • Technikal Mind
    • Uncategorized

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    Proudly powered by WordPress | Theme: micro, developed by DevriX.