Saturday, August 9, 2014

What does Streaming SIMD Instructions (SSE) mean?

The field of IT has more acronyms than the Earth has blades of grass. One of these is SSE (short for Streaming single instruction, multiple data instructions extension. Boy is that a mouthful.) Thankfully, SSE isn't as intimidating as it sounds. But in order to understand it, we must understand what instructions are. Instructions simply are a part of the computer that tells the CPU what to do (divide two numbers, store this information in RAM, etc).

SSE was introduced on the P3 (Pentium III) in order to speed up tasks CPUs struggled with, like DVD playback. SSE allowed a single instruction to handle more than one piece of data at a time, hence single instruction, multiple data without affecting basic CPU instructions. Currently, SSE has 5 generations, expressed as such: SSE, SSE2 etc.. Below is a basic list of improvements each generation brought

SSE2 - Similar to SSE but added ability to deal with double precision floating point numbers
SSE3 - Improved on SSE2 but improved process thread management and 3D operations
SSE4 - Improved text manipulation and media encoding. Comes in a few different flavours, 4.1, 4.2 and 4a (AMD)
SSE5 - Introduced by AMD on their Bulldozer CPUs in 2011. Improved performance for single threads and AES (advanced encryption standard) encryption.

Learning C#, Lesson 1: Data about data

When you think about metadata, what comes to mind? Perhaps you're thinking of the low level details NSA collects. ex: John Smith's call lasted 17 & a half hours (if you can believe it). Well, that's close but in programming we look at it in a vastly different way (I can personally assure you this lesson doesn't involve spying). Let's give metadata a proper overview, shall we?

In the context of a program, metadata is data about data. Remember that by any means necessary! (even if you have to repeat it until your face turns green.. Ok, don't do that) To illustrate: You want to buy strawberries by the pound but you know they sell by the gram. How would you solve this problem? If you answered "uh, just start writing the dang program?" you'd be wrong and I'll tell you why. No matter how simple this problem looks, it's best to break it down. A good programmer would start by asking themselves "hmm, which units will I be using; ints, floating point..?", "are there any values I shouldn't accept?". This is metadata, data about our data. And we use it to both organise our program and (perhaps more importantly) to write the program in a proper manner. The latter is especially true when writing programs for others.

For the time being, don't let the example bog you down. Just remember that metadata helps us structure programs.

At this point, you may be wondering where the code is. I can assure you that you'll see plenty of it, but I wanted to ease you into the subject by teaching you how to approach programming. Here's another reason thinking about metadata is important: If I take the above example and unconsciously decide to use integers (1, 2, 3, etc; no decimals) as my data type, I may very well pick out one too many strawberries (and then everyone behind you groans because the cashier must call the manager to have your total adjusted). Thinking critically about data is essential to writing good programs.

For now, just be aware of what metadata is. This information will make more sense in the coming lessons. Next, you'll find about simple data types (some of which you've seen here in this post).

Wednesday, June 25, 2014

The Chronicles of An Aspiring C# Programmer: Intro

If you ask any seasoned programmer what's the best way to begin programming, they'll likely mention hands on learning. What they won't tell you (because you didn't ask the right question) is that self learning is tough. Granted, trial and error will always be involved but what happens when you're still solving a problem 2 hours or even 2 days later? Not only is this not ideal, it's also a stumbling block every beginner struggles with.

Part of the problem exists because very often, programming concepts are explained without retention in mind. For example, if I show you the following code:




Then I explain the gist of said code, it'll likely vanish from your mind like smoke in 10 minutes. This kind of hands on learning also usually fails to hammer home a crucial point: learning to program isn't just about learning a language. It's also about learning to think (critically) in a language. What of the empty parenthesis? What is this Main thing? Can this code be condensed? These are important concepts that I feel many resources miss.

Issues like this are why I've decided to keep a journal of sorts, chronicling my journey toward learning C#. This "journey" will undoubtedly be a long one (since I won't be brushing over code) but I feel this is necessary in order to promote retention. Readers can expect to find brain friendly examples (because we all know how reliable the brain is) as well as solutions to put concepts into perspective. Each topic will take the form of a single weekly post, though I will always answer questions to the best of my knowledge. I won't include every programming concept here because by then I'd by white haired and decrepit. Besides, by that time humanity will have figured out how to build computers that understand human language. But until then, sit back, put on your best learning face and enjoy. You'll soon discover why many regard learning programming as a rewarding experience.

Monday, March 31, 2014

Making Visual Studio Express & Comodo HIPS Play Nicely Together

If not configured properly, firewalls (Host Intrusion Prevention Systems, in this case) can make debugging a tedious process. Not only this, but it can also make auditing HIPS rules feels more difficult than performing calculus. Fortunately for Comodo users, there exists an option to allow programs based on groups:


  1. First, open Comodo by double clicking its icon (a red box with a thin white 'C')
  2. Navigate to HIPS rules by clicking 'tasks' in the upper right hand corner, then select 'Sandbox Rules' then 'Open Advanced Settings'. Expand the HIPS section to find its rules.
  3. Create new rule by right clicking then select browse. Here, select 'file groups' and any option within. We'll be creating our own logic next, so category is irrelevant.
  4. Expand your created group and double click. Answer yes to the prompt. Right click on the groups screen and choose to add a new group. Highlight your newly created group and add the following:

  5. These rules add exclusions in Comodo's HIPS engine for the console -- for console programs, along with your project folder. Of course, if you've changed your directory you'll need to update accordingly.
     
  6. Finally, repeat step 3 but choose your custom group. You'll also want to delete the policy we defined in step 3. Unfortunately, group policies become in-editable after creation.
Upon completion,  all debugging attempts will execute -- without any further interaction.

Saturday, January 18, 2014

Use Your Windows Phone As A Wired Microphone

What you'll need:

Male to male headphone cable (a must)
A free line-out extension
Wifi or data plan

  1. Download RealMicrophone from your Windows Phone.
  2. Plug in your headphone jack (must be double sided!)
  3. Enable 'Line-in' by hitting start and type manage audio. Click the matching result (there will be a few other options.) Now, make sure Line in is set to enabled.
  4. On RealMicrophone, swipe to the next screen and hit 'play'
Enjoy your newfangled microphone. This is ideal for people who want to use VoIP or Rosetta Stone but don't have a proper microphone.