3ENGINE

Programación y otros cachivaches

Categoría: English

English, Tecnologia

How to insert an InputBox in C#


Although seem lie, in the C# language not exist a dialog box for ask a data. If you don’t want create your own dialog box and don’t need personalize it, you can use the sentence Inputbox that you can find in Microsoft.VisualBasic assembly.
This sentence show a modal dialog with a label, text box, a button accept and other button for cancel.

The definition of sentence InputBox is as follow:

       
public static string InputBox(
        string Prompt,
string Title,
string DefaultResponse,
int XPos,
int YPos)
  • Prompt: Dialog message
  • Title: Optional. Dialog title.
  • DefaultResponse: Optional. answer by default.
  • xPos: Optional. Coordinate X, centered by default.
  • yPos: Optional. Coordinate Y, centered by default.

Steps for insert an InputBox in C#:

1. Insert a reference to Microsoft.VisualBasic assembly:

How to insert an InputBox in C# - 1

How to insert an InputBox in C# - 2

2. Insert the sentence:

private void btnClickInputBox_Click(object sender, EventArgs e)
{
    string texto = Microsoft.VisualBasic.Interaction.InputBox(
        "Texto de la pregunta",
        "Titulo del diálogo",
        "Respuesta por defecto");
}

Note: if the user cancels the dialog then the statement returns an empty string

Result:

How to insert an InputBox in C# - 3




English, Tecnologia

How to retrieve email sent from outlook


You can retrieve a email missing of the outbox if the person to which the mail is addressed has not read.

1. You go to the outbox and search the message to recover. Open it and select «Other action > recover message…»:

retrieve email sent from outlook

2. If successful, you will receive a message like this:

retrieve email sent from outlook




English, Tecnologia

How to fix the WordPress error «Fatal error: Allowed memory size»


If WordPress show a message error “Fatal error: Allowed memory size”, for example to add a picture or installing a new plugin in your wordpress account. This is because you are exceeded memory limit reserved to PHP and you need increase it. I propose different solutions.

Wordpress error "Fatal error: Allowed memory size"

Solution at WordPress error «Fatal error: Allowed memory size»

Login via FTP client (Filezilla for example) to your hosting account and try to solve the problem
with one of the following solutions:

  1. Edit wp-config.php file, the file is in the blog root folder and add at the end define(‘wp_memory_limit’,’XXM’); where XXM is the amount of memory you need:
    /** WordPress absolute path to the WordPress directory. */if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');
    /** Sets up WordPress vars and included files. */require_once(ABSPATH . 'wp-settings.php');
    
    define('wp_memory_limit','80M');

    If you don’t solve the problem, try with define(‘WP_MAX_MEMORY_LIMIT’, ‘XXM’)

    /** WordPress absolute path to the WordPress directory. */if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');
    /** Sets up WordPress vars and included files. */require_once(ABSPATH . 'wp-settings.php');
    
    define('WP_MAX_MEMORY_LIMIT', '80M');
  2. Edit .htaccess file, this file is in the blog root folder (probably hidden)
    and add the code line php_value memory_limit XXM:

    <IfModule mod_rewrite.c>
    php_value memory_limit 64M
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
  3. Try to increase a memory specified in the default-constants.php file,
    this file find it in wp-includes folder. Edit line 9 where in the example
    is define(‘WP_MEMORY_LIMIT’, ’48M’); and especified increasing the memory you need:

    function wp_initial_constants() {
    global $blog_id;
    
    // set memory limits
    if ( !defined('WP_MEMORY_LIMIT') ) {
    if( is_multisite() ) {
    define('WP_MEMORY_LIMIT', '64M');
    } else {
    define('WP_MEMORY_LIMIT', '48M');
    }
    }
    
    if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
    define( 'WP_MAX_MEMORY_LIMIT', '256M' );
    }

    If your wordpress install is multisite, then modify line 7 where in the example is define(‘WP_MEMORY_LIMIT’, ’64M’);