Home » Blog » Otro Blog Mas

Otro Blog Mas

About otroblogmas

Otro Blogmas is a popular Spanish language blog that focuses on all things related to the holiday season. The name “Otro Blogmas” translates to “Another Blogmas,” which refers to the trend of publishing daily blog posts throughout the month of December leading up to Christmas. This tradition has become increasingly popular among bloggers around the world, and Otro Blogmas is one such platform that provides readers with festive and engaging content during this time of year.

One of the standout features of Otro Blogmas is its diverse range of content categories. From food and drink to crafts and home decor, there is something for everyone on this blog. For instance, visitors can find delicious holiday recipes like gingerbread cookies and hot cocoa bombs, as well as tutorials for creating their own DIY advent calendars and wreaths. Additionally, the site offers gift guides, travel recommendations, and even tips for managing stress during the busy holiday season.

Another notable aspect of Otro Blogmas is its visually appealing design. With high-quality images and an easy-to-navigate layout, the site draws users in and encourages them to explore its many offerings. Moreover, each post is carefully curated and edited, ensuring that readers receive accurate and helpful information. Whether browsing on a desktop computer or mobile device, Otro Blogmas delivers a seamless user experience.

While the majority of content on Otro Blogmas is written in Spanish, non-Spanish speakers need not worry. The site includes a convenient translation tool that allows users to translate text into several different languages, making it accessible to a wider audience. Furthermore, the site often shares visual content like infographics and videos, which require no language skills to understand. Overall, Otro Blogmas does an excellent job of catering to a global audience while maintaining its unique cultural identity.

Finally, what sets Otro Blogmas apart from other blogs is its commitment to community building. The site regularly collaborates with other bloggers and influencers, hosting giveaways and contests to engage its followers. By fostering a sense of belonging and shared enthusiasm for the holidays, Otro Blogmas creates a welcoming environment where readers feel inspired and empowered to celebrate the season in style.

PHPUnit Cheat Sheet

After learning how to build unit tests, studying PHPUnit thoroughly, and taking notes, I only needed to create a PHPUnit Cheat Sheet.

Based on PHPUnit version 3.6, it includes the various “assert” methods that exist, the necessary elements for generating Mock Objects, utilities, examples, and more.

Any corrections or improvements will be gladly received.

Version 0.1

How to Return a 410 Status Code in WordPress

In searching the internet, I have attempted to find a way to return a 410 header for specific URLs in WordPress. I found two methods that were not of interest to me:

One is a plugin called “410 for WordPress.” Upon studying this plugin, I noticed that it is not the most appealing option to me, as its functioning is as follows:

In the administration panel, it creates an options page where you can add records that will return 410. These records consist of regular expressions and are stored in a new table created by the plugin.

For every request made to WordPress, it loads all the records from that table and checks all the regular expressions against the URL being requested to discover if it’s a 410 error.

I consider this cost to be high for each request, especially if you only want to set 410s for a few well-defined URLs.

Another option is to set the Apache error 410 page via the ErrorDocument statement and create a file specifically for it.

We determine all the URLs we want to return a 410 for via .htaccess with the G flag.

One might think about setting that file as the 404.php of our theme, but it does not work since the entire WordPress environment is not loaded correctly.

Therefore, I developed a combination of the two previous options. It combines the benefits of setting rules through Apache while displaying the same error page as WordPress for a 404. You can customize it further by creating a 410.php template if desired.

Firstly, you need to modify the Apache ErrorDocument:

ErrorDocument 410 /index.php?error=410

In the functions.php file of your theme, add the following code:

**
* Reponse the header 410.
*
* @param string $template
* @return string
*/
function e12_response_410( $template ) {
    if( is_404() && '410' == $_SERVER['REDIRECT_STATUS'] ) {
        status_header( 410 );
 
        if( file_exists( STYLESHEETPATH . '/410.php' ) ) {
            return STYLESHEETPATH . '/410.php';
        }
    }
 
    return $template;
}
 
add_filter( 'template_include', 'e12_response_410' );

And now, simply add the following rules to Apache to return the 410s:

RewriteRule ^url-eliminada$  - [G,L]

If everything works correctly, when requesting that URL, it will return the same page as a 404 error, but with the header of a 410.

To configure XAMPP for debugging with XDebug in NetBeans

XDebug is an open-source tool for PHP developers that offers many functions for projects, such as debugging, tracing, logging, and more. There is a series of 5 articles on Zend Developer Zone that serve as an advanced manual rather than just an introduction to get the most out of XDebug. This will explain how to configure it to work with Netbeans and debug projects, including those using Zend Framework.

Assuming a normal installation of XAMPP, to activate the debugging features through Netbeans, you need to modify some parameters in the php.ini file (C:\xampp\php):

Uncomment the following line:

zend_extension = "C:\xampp\php\ext\php_xdebug.dll"

You need to indicate the following values (mostly by uncommenting):

xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"

After that, you have to restart Apache so that the changes take effect.

By viewing the server configuration through a phpinfo(), you can see if the changes have taken effect by observing the following features:

The only thing left is to configure Netbeans. First, you need to modify the general options of the IDE. Go to Tools > Options, then go to the PHP tab and General section, and make sure the values are as shown in the image:

To modify the project, go to Project Properties, and under the ‘Sources’ and ‘Run Configuration’ sections, set the relevant paths. For projects made with Zend Framework, you need to modify the ‘Web Root’ to indicate that it is the ‘public’ directory. And in the ‘Debug’ section, check the box as seen in the image.

Now, you can debug your project by pressing Ctrl + F5. Here is a recommended page to start learning about the options that Netbeans and XDebug offer: Debugging PHP Source Code in the NetBeans IDE.

This guide will help you understand how to use the debugger, step through code, inspect variables, and more. It provides detailed instructions on how to set breakpoints, navigate stack traces, and view the call hierarchy of your PHP code. With these tools, you’ll be able to quickly identify bugs and optimize your PHP development workflow.

Design Pattern: Observer pattern

The Observer pattern is an easy-to-understand pattern and easy to identify when needed. It is classified as a behavioral pattern.

The context of this pattern is when we have several observer objects and one object observed by the observers. The observers need to be aware when a change occurs in the observed object. The first approach that may come to mind is to have a process/thread/task/… that will be in charge of periodically making requests to the observed object so that it can detect when the change has occurred.

The problem arises when the interval between requests is very short, or there are too many observer objects making requests to the observed object, or it is necessary for the observer to be notified immediately after the change of the observed object.

The solution applied using the Observer pattern involves adding observer objects to a list of objects and having the observed object notify all objects on the list when a change occurs. In this way, there is a role reversal: the observer who had the task of being aware of the change, now waits to be notified by the observer. Let’s try to detail it:

the observer object needs to be notified of changes in the observed object.

the observer object is added to the list of objects to be notified, of said observed object.

a change occurs in the observed object.

the observed object iterates over the list of registered observers, and notifies them of the change.

Moving to programming language, this relationship can be achieved with an interface and an abstract class:

Observer Interface:

notify(): observer objects need a function that will be executed from the Observable object when a change occurs.

Abstract Observable Class:

observers: list of observer objects added.

registerObserver(Observer): adds the observer object to the list of objects to be notified when a change occurs.

deleteObserver(Observer): removes the observer object from the list.

notifyObservers(): iterates over the observer objects in the list, to call their notify() function.

Now you only need to inherit and implement, customizing according to your needs. The resulting UML scheme would be similar to the following:

The final outcome is that observer objects do not make any request while nothing changes. When a change occurs, they are notified of the change. The notify() method of the observer object can be programmed in two ways:

when executed, it makes a request to the observed object to find out about the change.

when executed, it receives a parameter from the observed object, with the change made.

It depends on the context. Clearly, the first option requires an additional request.

Update 2010-02-03: I add a sequence diagram of the process where two observers are added to the observed object’s list, and then notified.

To install the drivers for the Atheros AR9285 wireless network adapter on Ubuntu

In the ASUS 1101HA laptop, there is an Atheros AR8132 ethernet card and an Atheros AR9285 wireless card. When you start the Ubuntu Jaunty 9.04 LiveCD on this laptop, you will find that the drivers for both the WiFi and ethernet cards are missing, and therefore you do not have a connection.

To install the drivers, you need another computer with internet access only to download the files and transfer them to the laptop using a USB drive. According to a Ubuntu forum, here are the steps to follow:

Go to the Linux Wireless page and under the Releases section, download the latest version. As of August 2009, the file to download is compat-wireless-2.6.30.tar.bz2 which is less than 2MB.

Uncompress the file into a folder and transfer it to the laptop running Ubuntu.

Open a terminal in Ubuntu, navigate to the copied folder and run:

make

sudo make install

sudo make unload

After installation, modify the ‘modules’ file:

sudo gedit /etc/modules

Add the following line at the end of the ‘modules’ file:

ath9k

Save, exit and restart Ubuntu for changes to take effect.

If everything went well, you should now be able to see WiFi networks in Network Manager.

NOTE: After installing all updates from Ubuntu, you may lose WiFi again. You must repeat part of the process, and after restarting, you will have WiFi back. Just write these two commands in the driver folder, then restart:

sudo make install

sudo make unload

NOTE: Although I am not very knowledgeable, I believe the problem is due to the kernel version. When performing a software update in Ubuntu, there are kernel updates. It is believed that in Ubuntu version 9.10, the drivers will come integrated in the kernel and this problem will not occur. All this is speculation. Any information would be appreciated.

Leave a Comment