RafikiTechnology regular expression cheatsheet
Little TipsWeb Development

Regular Expression

This is more of a note-to-self type of post.

You know that series of symbols and characters in a chain following each other? Sometimes you will find them with a find, replace, or find and replace function.

Examples:

  • This processes a URL:
  • somefunction.replace(/^http[s]{0,1}:\/\/[^\/]*\/?/, '/')
  • From WordPress: The following example removes all HTML comments in the first pattern, and causes a favicon (with any filename extension) to be loaded from another domain in the second pattern:
    #<!--.*?-->#s =>
    #\bsrc="/(favicon\..*)"# => src="http://mycdn.somewhere.com/$1"

Well, they are called regular expressions and you can learn more about them at some of these sites:

Any comments, suggestions, or questions? Please drop a note.

Advertisements
Little TipsNetworkingPrinters and DevicesWindows 10 Tips

ControlCenter4 error CC4-202

How To Get Here

So, there you are with your brand new Brother (e.g. a Brother MFC-L58000DW Series) multifunction (all-in-one) printer, scanner, and fax trying to scan a file from the Device (the scanner itself) to a PC, e.g. a Windows 10 PC.(Jump to Solution Options)

You go the usual way and click Scan to PC, but after you select which PC to scan to, nothing major happens on the scanner. The paper is not drawn into the wide open mouth of your scanner. Instead you scanner’s little LCD sits there telling you to check your firewall settings to allow communication between this scanner and your PC. Maybe you even go and disable your firewall on the PC or do something just as useless and dangerous.

Eventually, you decide to Google this and find this note I wrote to myself (and now to you). Ok, enough rambling, the solution is simple. Well, if the first solution works. Because, otherwise there are 4 to 6 other possible solutions, some more difficult than others. I will list them here, but you can find more details from the source article on Brother’s official website*:

Possible solutions**

Option 1: This solution is for Network Users Only (Machines that have a built in network card only): if you are connected to two different networks at the same time (e.g. Wi-Fi and Ethernet), disable one of them to keep only the one on which the printer can also be found. Then try to scan from the Brother Device and watch for the error message. You may need to restart your computer and check your network to confirm you are still connected to only one correct network.***

Option 2: For Network Users with only one network connection. Hunt down the TWAIN file labeled Twain001.Mtx and delete it (I would first just move it to another location until I determine that this is the solution that works for my case) from your AppData\Local\Temp folder which itself can be found inside your current user folder. Please note that you might need to unhide the AppData folder first. Restart your computer and test the scanner. If you continue receiving the same error message. Check if Option 3 is you case.

Option 3Download and run the ControlCenter4 Update Tool. If you are not of any of the previous two options, you may need to update your Control Center. You should be able to find the ControlCenter4 update tool on Brother’s Downloads page. Install the update tool, run it, restart your computer when prompted and then try to scan again.

Option 4: Reinstall the Brother MFC Pro Printer Utilities program. You can do so using the Uninstall program that is furnished by Brother together with the Printer Utilities software. Restart your computer then reinstall the Brother MFC Software from the original CD. You can also download the Full Driver and Software Package ( please navigate to their downloads page) from their site and install it. Try your scanner after the new software product is installed.

If the problem persists. Try to get in touch with your network administrator or with Brother, the company that produces your printer. You could also just stick to start your scans from the PC until a solution is found.

Disclaimer: *Try at your own risk. **I wrote down these steps as I learned them from Brother’s official site and am not intending to appear as the author of the above troubleshooting steps. ***THIS SOLVED MY ISSUE

AntivirusLittle TipsSecuritySmartphones

What’s that text from v5d@urdoc.us?

If you are like me, you did not want to open an apparently random text from v5d@urdoc.us or whatever the username@urdoc.us that just came to your phone. So you did a quick search in your favorite search engine and this article came up.

So, nothing to worry about. It’s just your optometrist or your dentist (one of those medical professionals you recently visited) reminding you of an appointment or a prescription to pick up.

Alright, with that said, here is a little disclaimer: be careful! Some crazy dude could forge this and spoof that sender’s email address. So, do not download or open any attachment if you can help it. First call your doctor to confirm (or check your email) and see if they sent you any notification.

Great! I hope you have a some peace of mind now. I did once I was reassured and run the antivirus and all the good stuff any cautious person would wanna do.

And, oh, one more thing. If you have considered blogging on WordPress.com or Jetpack before, get it it now! They have a 30% Off promotion if you use coupon code HOLIDAY30 by December 31, 2017.

WooCommerce

NetworkingWindows Server Tips

Can’t Find Server in Network

You have installed Windows Server 2008 R2, you have installed the application you want to make available to multiple endpoints on your LAN (Local Area Network), and you have even created your Share on the server. Good!

Then comes the time to setup the endpoints or client computers that will consume your application, but there is one problem, Ma’am/Sir! You cannot find the Share on the network. In fact, you cannot even find your server on the network!! What do you do?

You go to your Services on the server and enable the service named Computer Browser. This service is disabled by default. So, turn it on and you are good to go! Go check on the endpoints’ list of network devices on your LAN and you should see your server there. If you do not, please leave a comment here.

Some external help here from the people at Websense:

1.Make sure that Windows Network File Sharing is enabled.
  a.Go to Start > Network > Network and Sharing Center.
  b.In the Sharing and Discovery section, set File Sharing to On.
2.Go to Control Panel > Administrative Tools > Services.
3.Double-click Computer Browser to open the Properties dialog box.
4.Set the Startup type to Automatic.
5.Click Start.
6.Click OK to save your changes and close the Services dialog box.

And from the people at Microsoft Technet.

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

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.