Category: Web Development

Sitemap Illustration
GoogleLittle TipsSEOWeb DevelopmentWordPress

How to Refresh My Sitemap for Google Search Console to Find It?

Is Google Search Console failing to retrieve your website’s sitemap? It is possible that you need to refresh your permalinks.

To do that:

  1. Go to your /wp-admin page.
  2. Go to the “Settings” menu and click on Permalinks.
  3. Once on the permalinks page, without altering anything, click on “Save Changes.”

Give it some time and then go test yoursite.com/sitemap.xml and see if Google is finally picking something up.

You can find some more ideas here:

Advertisements
Little TipsPythonWeb Development

Python, AttributeError: ‘module’ object has no attribute ‘config’

Four years ago, when I first started learning Python, I came across a problem that would later on become a “Famous Question” on StackOverflow. You may be reading this article because you encountered the same problem.

Traceback (most recent call last): File “C:\Users\myname\documents\visual studio 2010\Projects\PythonApplication 1\PythonApplication1\RunSikuliOnVM.py”, line 97, in logging.config.dictConfig(LOG_DICT_CONFIG_OnVM) AttributeError: ‘module’ object has no attribute ‘config’ Press any key to continue . . .

So, I will quickly suggest you check what turned out to be my problem.

I had imported a module into my code and later on made reference to that module by calling a specific attribute, but there was no such attribute in the module. Or at least so thought my Python interpreter. The quick fix for the error that I had gotten turned out to clear the cache of my interpreter. An example of how to do that with an interpreter is in the documentation for PyCharm.

This seems to be what is meant by the Python 3 documentation when it warns that “multiple evaluations of the same attribute reference may yield different objects.” I extrapolate and conclude that the error I am observing is somewhat of a “different” result I am getting.

Now for those interested in understanding the AttributeError for its own sake, another part of the Python documentation describes the exception in these terms:

exception AttributeError :Raised when an attribute reference (see Attribute references) or assignment fails. (When an object does not support attribute references or attribute assignments at all, TypeError is raised.)

 

The problem with the case at hand is that the config module does have a config attribute. This is why I posit that it is the caching issue that is the problem here since the interpreter may be referring to a totally different module than the logging module your code may be calling in this instance.

Note: This article is still in development even though it has been published to offer some beginning of a solution to those dealing with the AttributeError: ‘module’ object has no attribute ‘config’ exception.

Find Your historical DNS record
NetworkingRouters-Modem-FirewallsWeb DevelopmentWordPressWPEngine

How To Find My Old DNS Information Or DNS History

Ever been stuck in a situation where you cannot remember what your last DNS* information was? This may happen while migrating a site from one hosting provider to another, a domain from one registrar to another**, or any of the possible playing around you could find yourself doing with your DNS.

You may easily remember your CNAME records, but trying to find what your SOA, NS, A, AAA, MX, or TXT records*** were in the past can be a tricky exercise unless you are familiar with some really cool tools online like DNSTrails. I just used this tool a few minutes ago and it saved me from a lot of frustration as I wanted to temporarily revert my DNS records to what I just had deleted from my domain registrar.

I am sure there other tools out there, but this one just served me well, so I thought to share the insight with you!

Oh, also, if you ever want to temporarily make your computer point to a specific DNS setting for a specific domain, here are some useful resources:

  1. The Host File Trick on Mac and PC by WPEngine
  2. Editing the Host File on Mac OS X Leopard by WordPress

Finally, just for the sake of completion. Another site I really like is MX Toolbox, this online tool will help you check the propagation status of your DNS, MX, and other Records.

 

——

*DNS means Domain Name System

** Yep! That is actually possible! Just ask your current registrar how to migrate your domain
*** CNAME stands for canonical name and serves to make a domain an alias of another domain, MX stands for mail exchange and lists the mail servers that are to be used for a domain, NS stands for name server and tells which Name Server is authoritative for a given domain, SOA stands for State Of Authority and keeps up with when the domain was last updated and other similar information, A stands for address and is the IP of a given domain, AAAA is an IPv6 address records corresponding to a 128-bit IPv6 address while other addresses are mapped for 32-bit IPv4 addresses, TXT is a way for the domain administrator to enter any text into the DNS record. More on this at PCNames.

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.

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.