Thursday, May 19, 2016

Matlab RF Toolbox and alternatives

We're currently seeing a bit of contention for the one license we hold for Matlab's RF Toolbox.
In polling the Electromagnetics group profs about the need for any more licenses for RF, I heard back from Prof. Triverio that there is a free user-contributed toolbox for importing and converting S-parameters, which was the particular feature that he had initially found in Mathwork's RF Toolbox.

Here is a link to Tudor Dima's S-Parameter Toolbox:

You can download this to your local hard drive, then update the Matlab toolbox path cache to include the folder where you downloaded it, and you'll be ready to use this. There are no dependencies on other toolboxes.

If importing and converting S-parameters is the sole reason you needed RF Toolbox, then switching to this free alternative will relieve the contention for our single license for Mathwork's RF Toolbox. (If there are other functions in RF Toolbox that you do need to use, please feel free to carry on using it, and let your supervisor know so we can gauge if there's a need for more licenses for RF Toolbox.)

Wednesday, May 11, 2016

Malware prevention

We continue to be locked in an arms race against bad actors seeking to intrude into PCs we use and administer for nefarious purposes. Viruses and other malware keep innovating; anti-malware software has to scramble to keep up, requiring updates both to the 'engine' and the 'definitions' or patterns the security software checks for. These updates must be applied automatically, and users should in general not turn off this updating.

Why release malware?

In the past the biggest draws were either 
  • adding a compromised PC to a vast 'bot net' useful for sending out spam from thousands of distinct sources (making it harder to block source by source), or
  • logging user keystrokes in a quest to collect bank passwords and the like
Lately, the bad guys have zeroed in on a new way to make a lot of money exploiting security holes in other people's computers: ransomware. This involves injecting malware that runs with the user's privileges and encrypts as many of their files as it can find, including on network shares, then alerts the user demanding online payment (typically in untraceable Bitcoins) to unlock the data.

This type of intrusion is being focused on institutional users including hospitals, where our responsibility to keep data accessible for immediate use may pressure data managers to give in to these demands. The same could easily apply to research and teaching related data on UofT PCs.

Backups - the best insurance

The easy way to avoid the pressure to pay in such an event is to have current, secure backups. The backups must be located offline - otherwise the ransomware may just encrypt your backups while it is encrypting your live data. The backups must also be working properly and be readily accessible when the intrusion is detected. Doing a trial restore from your backups and verifying this brings back what you expected is the only way to be really confident the backup system is working as intended.


Ideally we will always keep every PC so secure that no malware ever gets executed. So anti-malware software is needed. Where can we get this? Microsoft encourages all users to run their Security Essentials on any personal PC or laptop; under the MS Campus Agreement, we're entitled to run Forefront Endpoint Protection on every UofT PC. That's a good start, and we should ensure it is activated and getting updates. But is FEP sufficient? Many feel it may not be. Here's one post discussing that question:

Many third party software publishers offer subscription-based anti-malware programs for Windows. The site I prefer for seeing which of these is rated the most effective is where they regularly re-test all listed products.

On their listing are a few products that offer free installation for academic use. The one I'm evaluating for this presently is 'Avast for Education' which you access through their site. It offers a free login account for you as site administrator, then lets you deploy their endpoint protection tool on as many clients as you like. Your 'dashboard' on their website lets you monitor all linked endpoints via the cloud. 

Defense in Depth

Most commenters on ransomware observes there is no 'majic bullet' to turn away this threat once and for all. They encourage 'defense in depth' where we aim to eliminate part of the risk at each of multiple points along the way:

  • maintaining regular backups, including a means to isolate backups from the desktop
    • don't leave the backups writable by the user, so ransomware can't encrypt your backups while it is encrypting your live data
  • using a firewall with frequently updated policies to block malware network activity
  • keeping endpoint (desktop and laptop) anti-malware software installed and updated
    • choose a product that covers anti-virus and internet security to block malware
  • keeping browsers locked down:
    • set up secure browsing settings
    • fewer plug-ins, remove any out of support
      • remove QuickTime
      • remove Silverlight
      • remove Flash Player
    • regularly update any required plug-ins subject to malware
      • Java 8-(
  • keeping users educated about social engineering tricks used in malware emails and websites
    • "Log in here to recover access to your... " {bank, email account, etc.}
    • "Please pay the attached invoice promptly" {apparent PDF, but virus inside}

Tuesday, April 5, 2016

What toolboxes are required by this Matlab code base?

Matlab is distributed as a core application plus a large menu of available toolboxes and blocksets which can be licensed separately. Today I was helping a Matlab user install an additional toolbox required by a project he's taking on. He mentioned that this is starting from existing Matlab code he received from another user.

When you 'inherit' existing code from someone else, one key question from the start is what are the dependencies. Of course good computer engineering practice includes documenting one's code and identifying all dependencies, to spare future users the need to trace them all manually later. But we can't always count on the person before us having done so.

So you could open a Matlab project and find it requires any number of different toolboxes. Does  your copy of Matlab have all the ones it needs? To find out, you could start the code and wait for it to halt with error messages about missing toolboxes, then see if you have a license for that, and get it installed. (You just have to hope you trial run(s) exercise every branch that reaches a dependency you need to resolve! Want to solve the halting problem while we're here?)

Fortunately, in Matlab (since R2012a) there is a 'dependencies' function, including a call to generate a list of the Matlab toolbox names that the specified body of .M code requires. You pass it a path to the location of the code you want checked, and it returns a list of required toolboxes. Voila!

Here is the Mathworks page on this:

To automate testing if all the listed toolboxes are installed, you can call

ver toolboxname

You can also test if a license is available for a toolbox using Matlab's license() function:

The license('inuse') command lists what licenses your current Matlab session has checked out (this could include any licenses you accessed during the same session that the license server has not yet timed out, including ones used by a previous task.)

Thursday, March 5, 2015

Matlab and/or the "R" statistics package

Prof. Moshovos asked me about R - the open-source stats and visualization package, and how it compared to Matlab. R is a free download from
I'll break this into several sub-questions:
  • Do R and Matlab address similar needs? Does R 'compete' with Matlab? 
    • in short: yes, to a good extent
  • Could the free R package replace the pricy Matlab for some users?
    • for basic tasks, it might; for specialized toolboxes, optimizations? No.
  • Would Matlab users find any benefit in learning and incorporating R in their software kit?
    • Why not - try it and see...
  • Can R and Matlab be hooked up together?
    • Yes: see RMatlab (linked below)
First, my replies are based on hands-on familiarity with Matlab but only what I've read online about R. Second, my answer to this for ECE users will differ from what you would advise the 'engineer on the street' outside of the University. For someone starting out without existing Matlab licenses, and without access to Mathworks' academic pricing, the chips might fall differently.

Our department holds a large shared pool of licenses for both Matlab, Simulink and a good range of additional toolboxes devoted to various specialized EE/CE subdomains such as power grids, communications, optimization, signal and image processing, RF, etc.

While the R community does produce some (also free) R packages for specialized tasks, I'm prepared to venture (without having searched exhaustively) that they have nothing comparable to the range of detailed, tested and optimized toolboxes offered by Mathworks.

That is (perhaps predictably) the response to this very question offered by Mathworks themselves, here:

We host training events offered by Mathworks once or twice a year. We also have access to Mathworks customer support, which we've found responsive but have not needed to resort to more than a very few times. As a free, open-source package, R does have extensive community 'support' through forums, but no dedicated technical support service. For me this is not a deal-breaker. We're all used to doing our own troubleshooting and online bug research.

Here's an interesting post by a 'forced convert' from Matlab to R (cost driven) who is now quite happy using R alone:

He goes into the issue of performance optimization: Matlab has a large full-time staff dedicated to both code quality and performance. The volunteers developing R may make efforts at both, but I suspect it's asking too much of them to compete with Mathworks on either of these fronts. Matlab has put a lot into leveraging modern multi-core CPUs and the huge floating-point performance of GPUs on better video cards (and dedicated computational GPU boards.)

Does R complement Matlab?

People like R for its strong, flexible set of visualization tools. Matlab also offers lots in the way of visualization, but some might prefer what R has to offer (I can't give an informed opinion of my own on this point.)

Interestingly, enough people have wondered about this that an open-source package "RMatlab" has been released offering interfaces both for calling Matlab from R, and vice versa:

Be aware that R and Matlab have similar but distinct syntax and program structure, so mixing the two may stretch your brain a bit. This PDF goes into some of the nitty-gritty details:

R vs. Matlab syntax and coding rules

Thursday, December 12, 2013

New scientific graphing library

I just came across a mention of this new library of scientific graphing routines. Their API supports Matlab, perl, python, R, Julia, REST and Arduino. I haven't tried this out yet, but it looks quite powerful and worth checking out. If anyone finds it useful (or not) please email me your feedback and I can update this post.!

Friday, June 29, 2012

Ordering MS SCEP licenses in uShop

The UofT Licensed Software Office lets department staff place electronic orders for software licenses for a number of products through the central uShop procurement system. ECE faculty who need to order licenses for Microsoft System Center Endpoint Protection (to replace expired Symantec licenses) can have their admin assistant order these through uShop at the very affordable price of $3.25 per licensed PC per year. Simply count up the number of Windows PCs you need to protect with SCEP, and order that many licenses. These are good for one year and you will need to reorder annually. If you acquire more PCs during the year (without retiring an equal number) and thus need more licenses, simply place another order for the net number of additional licenses needed.

Let your admin know which FIS numbers to charge, and refer him or her to these steps. Here are screen shots of the steps to follow (steps for each screen are in the caption below the image):

Log in to uShop and click on "shop" to begin the order

In "step 1" click on 'Licensed Software Office'
(you may have to tell your browser to allow the 'pop-up' window)

At the top left, click on 'Software'

Click on 'Microsoft' (text below the MS logo)

Click on 'Servers' (text below the logo)

click on System Center 2012 Endpoint Protection (text below logo)

In the Qty: box below SC2012EP, type in the number of licenses you are ordering;
if you don't already have the installer, also fill in Qty: 1 under "CD..." to get a CD for $4.
Then click 'Add to Cart.'

Review your order details, then click 'Checkout'

After you click Checkout you will go to screens for filling in the FIS account numbers (screenshots omitted).

UofT Twitter accounts

 I noticed that some UofT peeps doing campus life promotion are using Twitter accounts with something followed by 'UofT' or '_UofT' in their twitter account name. So I tried a search of usernames containing "UofT' -- wow, there are a lot!

This link shows you a current list: Twitter accounts with 'UofT' in the name

ECE has a twitter account: @eceuoft

The IBBME (which includes some ECE profs) has one as well: @IBBME_UofT

Besides these I'll leave you to find more that interest you. There are some 'official' feeds from units within UofT such as libraries, departments, campus papers, etc. There are feeds for many student associations including the GSU, ASSU, etc., departmental student groups, charity and service groups, and for groups for students from many countries and regions.