All posts by Rafiki Technology

We learned a ton in school, on the job, but also from great technical insights that others shared on various platforms. We are just giving it back and glorifying Jesus Christ, the Inventor of all human beings. Please note that all information shared on or through our site is of good faith and is not intended to cause any harm individuals, groups, organizations, or devices. Just to be clear: you assume all responsibility for anything you do; we are not liable for anything that should go wrong.

Web Development

Angular Unit-Testing: TypeError ‘angular.element.cleanData is not a function’

Fact: When angular and angular-mocks do not agree, Jasmine gets angry

Today’s post is more like a “Note to self.” When angular and angular-mocks to not agree, go ahead and make sure they are of the same version*. Otherwise PhantomJS, Firefox, Chrome, etc.. will fail your tests and that’s bad karma** and a bad relationship with Jasmine.

Ok, onto the problem: TypeError angular.element.cleanData is not a function… Did you just see that when trying to run your little nice karma: karma start karma.conf.js (that’s the name we chose for our test configuration file, but your name is most likely different but still a JavaScript file)?

Don’t panic! The guys at Github have something for you. They say it is a known issue (as of when the article was written of course). While some choose to downgrade their angular and angular-mocks to avoid the problem, others just upgrade angular and angular-mocks with the one-liner:

npm update angular angular-mocks -g

Please remember to use sudo if you are on Mac or Linux for this global scope (-g) operation.

With that done, if the tests continue to fail and you have made sure your test scripts are clean, the problem will most likely be resolved with this trick suggested by @KeithPepin in the github solution: go to your angular-mocks.js file (e.g. ~/bower_components/angular-mocks/angular-mocks.js) and replace angular.element.cleanData(cleanUpNodes); with if (angular.element.cleanData) angular.element.cleanData(cleanUpNodes);

And there you go until the people at angular get their act together and fix the issue!

Run your karma file again to see what happens and leave a comment here if you do not get green checks for success!

* You can check versions with npm angular –version and then npm angular-mocks –version

**Don’t get me wrong, this karma here is just for the same of the pun.

Please read more here about unit testing with Angular.

Advertisements
Windows 10 TipsWindows Server Tips

How About a Shortcut to Log Off

Push button to log offYou know how you have some of those users who need a shortcut to log off their session on your server? Well, now you can make them one.

Just create a “log me off.bat” file on the desktop and edit it to contain the following string: shutdown /l

Notice: This is the letter “l” and not the number 1.

When they double click on that, they are out!

Oh, you can also customize the shortcut and change the ugly icon of bat files to something more relevant to the purpose of the code.

 

NetworkingRouters-Modem-Firewalls

RDP to Your Server Behind SonicWall or TP-Link Router

You just completed the installation of your new server. You now have a router in place, probably one of Dell’s SonicWall firewall routers or maybe a TP-Link router. But then you realize that you would like to be able to work from your hotel room or from the coffee store in the neighborhood. But how do you get to your server from outside while there is a firewall in the way?

Thankfully, there is a way to do just that. Well, actually a ton of ways, but we are here going to talk about just one of them: Remote Desktop Connection (or Microsoft Remote Desktop if you are working from a Mac), especially, about the setup to be able to use that program.

This tool enables you to take advantage of terminal services on Windows Servers. You will need to setup your modem and then your router to create a path from the outside world to your server.

Finally now, the moment of truth:
1) I do not think I can explain the setup of Remote Desktop Connection or even Microsoft Remote Desktop better than Microsoft themselves: http://windows.microsoft.com/en-us/windows/connect-using-remote-desktop-connection#connect-using-remote-desktop-connection=windows-7

2) The people at Dell have also explained the setup of the SonicWall better than I ever could this this knowledge base article: https://support.software.dell.com/kb/sw7501

3) Those at TP-Link did their part too: http://www.tp-link.com/en/faq-381.html

So, there you have it. Now you are an expert at how this whole thing works. Don’t thank me if you actually have. Thank the people at Microsoft, Dell, and TP-Link… and the God who created them!

Summary routing from remote desktop to server.

Summary routing from remote desktop to server. Image source: https://support.software.dell.com

Networking

Remote Desktop Services – Resource Sharing

Microsoft Windows comes with some interesting features to help manage how computer resources are shared among users using Remote Desktop Services. I first came across this feature on Windows Server 2012 R2 when I noticed that one of my users’ session was, pretty much out of the blue and quite often, disrupted by the server.

Most of the time it takes resetting their connection to the server for them to be able to reconnect and use the server resources–network, storage, or processor, but sometimes just a fresh attempt to reconnect the usual way just works.

To figure out what this was happening, I looked no farther than the log files to find the log message “Remote Desktop Services Network Fair Share was disabled for the user account DOMAIN_NAME\username” in the Event Viewer under Microsoft/Windows/TerminalServices-Remote Connection Manager/Admin.

A solution is suggested by a technet article, but the description is for Windows Server 2008. One has to find the equivalent for Windows Server 2012. The article suggests the following under Fair Share CPU Scheduling.

Fair Share CPU Scheduling is a new feature included with Remote Desktop Services in Windows Server 2008 R2. Fair Share CPU Scheduling dynamically distributes processor time across sessions based on the number of active sessions and load on those sessions by using the kernel-level scheduling mechanism included with Windows Server 2008 R2. On an RD Session Host server, one user will not affect the performance of another user’s session, even if the RD Session Host server is under a high load.

Fair Share CPU Scheduling is enabled by default. You can disable this feature by configuring the following registry entry to 0:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\SessionManager\DFSS\EnableDFSS .

Finally, trying to solve this led me to an even more interesting article describing Resource Sharing in Windows Remote Desktop Services:

From the Server 2012 RC Whitepaper, the 2012 fair share experience:

  • Network Fair Share. Dynamically distributes available bandwidth across sessions based on the number of active sessions to enable equal bandwidth usage.
  • Disk Fair Share. Prevents sessions from excessive disk usage by equal distribution of disk I/O among sessions.
  • CPU Fair Share. Dynamically distributes processor time across sessions based on the number of active sessions and load on these sessions.

The latter article also includes cool screenshots you should check out.

AntivirusBackup

Windows Server Backup – What To Do When Your Antivirus Locks Up Your Files

It happens sometimes that your favorite antivirus locks up your files every time your backup engine tries to access them for, well, backup. You may want to contact customer support for your specific antivirus. In my case, Bitdefender had set itself to protecting my files so much that my scheduled backup failed, failed, and failed… and failed again. So, I ask Bitdefender customer support for a quick guide on what to do. Following is what they said. It turns out to be what worked as well.

Most likely there is some interference with the backup process, adding an exclusion for the backup application process in the Antimalware > Settings section of your policy might fix the situation, I provided the steps below.
  1. Log in to Bitdefender Control Center.
  2. Go to Policies page.
  3. In case you already have a custom policy created, click on it in order to edit. Otherwise, click the + Add button to create a new policy.
  4. Go to Antimalware > Settings tab.
  5. Select Custom Exclusions.
  6. Choose Process from the Type menu.
  7. In the Files, folders, extensions or processes column, type the full path to the application you want to exclude from scanning.
  8. Choose On-access from the Modules menu and click the “+” button to add the application to the exclusions list.
  9. Repeat steps 4 to 8, but select ATC/IDS from the Modules menu.
  10. Click Save to send the policy to the target machines.

The wbadmin.exe and wbengine.exe files might be the ones for which you need to create the exclusions.

And yes, they were and they worked after I followed the steps. ‘Nough said!

I really couldn’t find a Bitdefender image with free license for reuse with modification, but I found this one about Ebola. So, let’s just learn

how-the-ebola-virus-attacks

How the Ebola virus attacks according to the WHO

 

Disk Management

Windows – Change Drive Letters and Paths…

If you are like me, there are things you do not think you will ever need until you actually need them. This is what happened when I found myself needing to claim the J: drive letter from WD Unlocker that had claimed it.

Where I work, we have assigned J:, among many other drive letters, to a specific network shared folder. But somehow, Western Digital’s WD Unlocker program wanted that very J: letter…

Alright, long story short, a I had to claim the letter back after assigning a different one to that letter-thieving software. Here is how:

  1. Open Disk Management. One way of doing it is to Run diskmgmt.msc
  2. Right mouse click on the volume that has the letter you need
  3. Click Change Drive Letter and Paths.
  4. Select the drive letter you want to rescue
  5. Click Change
  6. From the dropdown list select a new letter you want to assign to the mischievous volume. Please review some precautionary measures in your choice of letters.
  7. Validate the choice, and boom!

You are done! The captive letter is no longer captive.

faq-2-2

How to Change Drive Letter and Paths on a MS Windows 7 or a MS Windows Server 2012 R2 system.  Image source: http://www.windowsfaq.ru

Links:

Other and maybe more interesting links: