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.

Little TipsWeb Development

Simple Text Editor Right in Your Browser

What do you do with those little ideas that sometimes light up in your head but you have no notepad ready to jot them down? Well, you just open a new tab on your web browser and type:

data:text/html, <html contenteditable>

And there you go! You just transformed your web browser (most modern browsers with HTML5 should do it) into a notepad. Well, not really, but kinda. You actually just took advantage of the Data URI scheme (defined in RFC 2397) that allows to include data in-line in web pages.

Wanna Shave the File?

The most basic way of using this feature would be for quick ideas or links or other types of notes you do not intent to save. But if save you must, go ahead and Ctrl (or command) + S the web page, which will then be save as a… well, web page, not a text document. Oh, I also meant “save” the file, not shave. You know what I mean!

Where Does It Work?

Since you are still here reading all this, you probably are wondering already if this will work in your browser. We tested the feature in Chrome Version 50.0.2661.94 (64-bit), Safari Version 9.1, and Firefox 45.0.2. Everyone worked just fine. Please see screenshot for proof.

data text html contenteditable

Advertisements
Web DevelopmentWordPress

Your WP Site Is “Briefly unavailable for scheduled maintenance”

So there you are staring at your WordPress site or admin page wondering what just happened. “This is going to auto-update in just a minute and all will be back to normal,” you tell yourself, but nothing happens. Well, I suppose it is time for the quickest fix of all times for a problem of this size.toolbox-closed-for-maintenance

It turns out that this is a classic of WordPress since Version 2.7. During an automatic update of your WordPress site, WordPress places a file named .maintenance in your blog base folder. For as long as that file will be there, visitors to your site will see the message “Briefly unavailable for scheduled maintenance. Check back in a minute.

To bring your site back to usual business, just delete the .maintenance file either by FTP into the the folder that contains the wp-admin folder or by way of your hosting site.

Before I let you go, let me tell you about some people who have gotten really mad over this issue. They could not find the .maintenance folder because the file is actually hidden from Linux/Unix users since it starts with a dot. So, please make sure your set your File Manager or FTP client to show you hidden files. You can read the discussions here and here. Some of them address the question of where the file is actually located.

Important: Please remember verify that the update has been completed. Otherwise, try again.

That’s it for now, folks!

Source: The Maintenance FAQ at Codex.WordPress.org

 

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.

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.