UPDATE with variables to renumber column gives syntax error

Searching for a way to renumber a column within mysql, I’ve found multiple articles showing the same approach:

  • Renumbering an Ordering Field in MySQL
  • How to update a MySql column with ascending numbers

among others.

But trying it on my table I get a syntax error.

mysql> SET @rankStart = 10; mysql> SET @rankInc = 10; mysql> UPDATE fileFileTbl SET rank = (@rankStart := @rankStart + @rankInc) ORDER BY `rank` ASC; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank = (@rankStart := @rankStart + @rankInc) ORDER BY `rank` ASC' at line 1 

The command looks identical to the articles posted. What am I missing?

Here’s the table (with some columns omitted):

CREATE TABLE `fileFileTbl` (   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,   `fileEngineId` int(11) DEFAULT NULL,   `rank` int(11) DEFAULT '0',   `fileName` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT 'newfile',   PRIMARY KEY (`id`),   UNIQUE KEY `fileEngineId` (`fileEngineId`,`rank`) ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; 

System is Centos 8, with mysql as:

# mysql --version mysql  Ver 8.0.17 for Linux on x86_64 (Source distribution) 

Parse error: syntax error, unexpected ‘dbp_tb_branch’ (T_STRING) in wordpress

I am creating plugin which is not showing on admin menu. I don’t know what happened.

<?php /* *Plugin Name:Arsh Forms  *Author:Arsh Venveru * *Description:Create forms. *Version:1.0.0 *License:GPL2 *License URI:https://www.gnu.org/licenses/gpl-2.0.html */  defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); add_action('admin_menu','arsh_admin_menu_option'); function arsh_admin_menu_option() {     add_menu_page('arsh-form-table','arsh-Forms-Table','manage_options','arsh-admin-menu','arsh_form_table','dashicons-thumbs-up',40);} function arsh_form_table(){        wp_enqueue_style('shortcode_table1','https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css');     wp_enqueue_script('shortcode_table','https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"');      wp_enqueue_script('shortcode_table','https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js');       wp_enqueue_script('shortcode_table','https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js');       $  content=''; $  content .='<div class="wrap">'; $  content .='<div class="container">';   $  content .='<h2>VENVERU FORMS</h2>';   $  content .='<table class="table table-striped">';     $  content .='<thead>';       $  content .='<tr>';         $  content .='<th>Sr.no</th>';         $  content .='<th>Form Name</th>';         $  content .='<th>Form Id</th>';       $  content .='</tr>';     $  content .='</thead>';     $  content .='<tbody>';       $  content .='<tr>';         $  content .='<td>1</td>';         $  content .='<td>Venveru-Form</td>';         $  content .='<td>[Registeration-Form]</td>';       $  content .='</tr>';       $  content .='<tr>';         $  content .='<td>2</td>';         $  content .='<td>Display-Entries</td>';         $  content .='<td>[Display-Reg-Form]</td>';       $  content .='</tr>';       $  content .='<tr>';         $  content .='<td>3</td>';         $  content .='<td>Add-branch</td>';         $  content .='<td>[Add_Branch_Form]</td>';       $  content .='</tr>';       $  content .='<tr>';           $  content .='<td>4</td>';           $  content .='<td>Display-Branches</td>';           $  content .='<td>[Display-Branches]</td>';       $  content .='</tr>';       $  content .='<tr>';           $  content .='<td>5</td>';       $  content .='<td>Login page</td>';       $  content .='<td>[Login_page]</td></tr>';       $  content .='<tr>';           $  content .='<td>6</td>';       $  content .='<td>Add Book</td>';       $  content .='<td>[add_book]</td></tr>';       $  content .='<tr>';           $  content .='<td>7</td>';       $  content .='<td>Teacher Reg</td>';     $  content .='<td>[Teacher_Reg]</td>';     $  content .='</tr>';     $  content .='</tbody>';   $  content .='</table>'; $  content .='</div>'; $  content .='</div>'; return $  content; } add_action('wp_enqueue_scripts','arsh_form_table'); 

How can I solve this error?

Another syntax for Anydice mechanic question

I’m trying to build a function to model not just a roll of the dice, but to have boolean operators to toggle using various powers that effect the dice. I’ve gotten everything to work except for one thing- looking at the result of the roll, seeing if a ‘1’ was rolled and then changing that ‘1’, but only once.

The dice mechanic is for Cryptomancer, and it works by takinging your rank in a skill which is 1 to 5 and rolling that many d10’s plus a number of d6’s that total to 5 dice. For d10s, 1’s are always botches (-1), numbers under the target number are 0’s and numbers equal to or greater the target are successes (+1). On the d6’s 1s are botches, 6s are success and everything else is 0.

I’ve been using custom die for my rolls but set the function up to build the roll off just a skill number and challenge number. Here’s what i got so far-

function: sb B:n sp P:n skill SKILL:n vs CHALLENGE:n{ if P=1{ ROLL: SKILLd{-1,0:(CHALLENGE-2),1:(10-CHALLENGE),2}+(5-SKILL)d{-1,0:4,1} } else { ROLL: SKILLd{-1,0:(CHALLENGE-2),1:(11-CHALLENGE)}+(5-SKILL)d{-1,0:4,1} } if B=1{ if 5@ROLL=-1{ ROLL:ROLL+2 } } result:ROLL }

The goal is that you can toggle things by entering a 1 or 0 for the values B and P to turn them on or off. P=1 makes all ’10s’ rolled be worth +2 success instead of +1. B=1 is suppose to check the last value of the roll, and if a -1 is present add 2 to the whole total, there by turning one and only one botch into a success, even if there are multiple botches in the roll.

Everything works till i turn on B. then i get an error that the boolean operation if can only be used on numbers. Turns out 5@ROLL isn’t giving me the lowest roll of 5 dice but the probability of what that roll will be. How do i fix this? How can i convert ROLL:d into ROLL:s?

How many syntax trees can be made by a BNF

An example of this would be:


Expression = Expression Arithmetic Expression | number

Arithmetic = + | – | * | /

Through just breaking down 1+2*3+4, it was easy to find that the answer was 5 trees.

  1. 1+((2*3)+4)
  2. ((1+2)*3)+4
  3. 1+(2*(3+4))
  4. (1+2)*(3+4)
  5. (1+(2*3))+4

    But doing it in this brute force manner wouldn’t work on larger more complex BNFs.

I have tried using CYK to get 5 but haven’t figured out how, even through they do seem similar enough. Any advice on using any algorithms or strategies to break down larger BNFs to see how many syntax trees they can make would be much appreciated.

Counting the number of unique syntax trees of a grammar

Lets say we have some arbitrary grammar for which we would like to know how many different syntax trees does it generate. For example the following:

S -> A1|1B

A -> 10|C

B -> C1 | $ \varepsilon$

C -> 0|1

This is a quite simple language and the number of unique trees is not hard to figure out by just going through all of the different possibilities, but for more complex languages it gets difficult to count the number of unique trees by just examining it. For this reason, I’m wondering if there does exist some analytical approach, rules of thumb, or software that would allow to count the number of unique trees faster than just looking at the language long enough until all the possibilities are exhausted?

MySQL – Year Over Year – Query Syntax


I am working on a query to get Year over Year data comparison from current year to prior year.

For example, if current year is Jan 1st – now, I would calc that dynamically in my query but also bring in the previous year data for the same time frame (does that make sense?).

Here is my projection query that brings in current year and prior year but the data is dynamic yet static if that makes sense. CY is focusing on all of YTD while PY is doing entire PY.

How would I match PY to mimic what CY is doing essentially giving me all the data that I am needing from PY to do the comparison.

I would appreciate your help in advance.

        current_4wk_sales.store_no as 'store_no',         current_4wk_sales.store_name as 'store_name',         current_4wk_sales.zee_name as 'franchisee',         current_4wk_sales.marketing_source as 'region',         current_4wk_sales.cy_projections as 'cy_projections',         prev_wk_sales.prev_year_sales as 'prev_year_sales',         round(((current_4wk_sales.cy_projections - prev_wk_sales.prev_year_sales) / prev_wk_sales.prev_year_sales), 2) * 100 as 'percent_chng' from (     select store.store_uin,            store.store_no,            store.store_name,            store.zee_name,            store.marketing_source,            round((((sum(ro.total_sales - ro.taxes) / 100)) / (DAYOFYEAR(current_date() - INTERVAL 2 DAY))) * 365, 2) as 'cy_projections'      from cba_data_warehouse.raw_tm_data ro     join cba_data_warehouse.storeinfo store on ro.store_no = store.store_no     where posted_date between MAKEDATE(EXTRACT(YEAR FROM CURDATE()),1) and LAST_DAY(DATE_ADD(NOW(), INTERVAL 12-MONTH(NOW()) MONTH)) and ro.repair_order_status_id in (5,6)     group by store.store_uin, store.store_no, store.store_name     order by store.store_no asc ) as current_4wk_sales left join (     select         store.store_uin,         store.store_no,         store.store_name,         store.zee_name,         store.marketing_source,         round(sum(ro.total_sales - ro.taxes) / 100,2) as prev_year_sales      from cba_data_warehouse.raw_tm_data ro     join cba_data_warehouse.storeinfo store on ro.store_no = store.store_no     where ro.repair_order_status_id in (5, 6)     and ro.posted_date between MAKEDATE(year(now() - INTERVAL 1 YEAR),1) and DATE(CURDATE()- INTERVAL DAYOFYEAR(CURDATE()) DAY)     group by store.store_uin, store.store_no, store.store_name     order by store.store_no asc ) prev_wk_sales on prev_wk_sales.store_uin = current_4wk_sales.store_uin                 and prev_wk_sales.store_no = current_4wk_sales.store_no                 and prev_wk_sales.store_name = current_4wk_sales.store_name```  Thanks in advance! 

trouble in distinguishing between syntax directed translation and syntax directed definition

I am currently reading the dragon book ,chapter 2 is confusing me a lot according to it the definition of the two terms are:

syntax-directed translation

syntax-Directed translation is done by attaching rules or program fragments o productions in a grammar

my understanding of this is that in a production within {} we have some rules/program code that is executed(those rules/program are also known as semantic action)


A syntax-directed definition associates 1.with each grammar symbol, a set of attributes and 2.With each production,a set of semantic rules for computing the values of the attribute associated with the symbols appearing in the production

my understanding of this definition is that with each production we associate a action at the end of tail to compute the value of a attribute(this action are also known as semantic rules)

I have a few doubts regarding the two definitions 1. Is my understanding of this two definition correct?

  1. do syntax directed translation and syntax directed definition do the same task using two different ways?

  2. Is a syntax directedtranslation scheme same as syntax directed translation?

  3. what is the difference between syntax directed translation scheme and just translation scheme?

Syntax error around converting timestamps to time

I am writing a function that requires some comparison between the difference date and time parts of the timestamp data type. However it keeps running into syntax errors and I cannot find out what is going on. I looked into this post and keep having alternating errors like

psql:ERROR: operator does not exist: time without time zone >= timestamp with time zone and

plpgsql: No function matches the given name and argument types. You might need to add explicit type casts

Can anyone enlighten me what is wrong and what could be a direction I can head towards?

create or replace function riders_available_at_date_time(specified timestamp) returns table(riderId integer) as     $  $       begin         select F.riderId         from FullTimeRiders F         where specified::date between F.startDate and F.startDate+27         and exists (             select 1             from MWSWorkDays M join ShiftsInformation S on (S.shiftNumber = M.shift)             where M.riderId = F.riderId             and (specified::time without time zone between to_timestamp(to_char(firstStartHour, '99'), 'HH24')                 and to_timestamp(to_char(firstEndHour, '99'), 'HH24')) or                 (specified::time without time zone between to_timestamp(to_char(secondStartHour, '99'), 'HH24') and                     to_timestamp(to_char(secondEndHour, '99'), 'HH24'))                   )           union         select riderId         from PartTimeWorkingHourIntervals P         where specified between calculate_start_date(P.dayIndex, P.startDate)+P.startHour             and calculate_start_date(P.dayIndex, P.startDate) + P.endHour;     end;     $  $   language plpgsql;   create or replace function calculate_start_date(index int, starting date) returns date as     $  $       declare         position integer;     begin         select extract(dow from starting::date) into position;         index = (index - position)%7;         return starting + index;     end;     $  $   language plpgsql; 

Parse error: syntax error, unexpected ‘,’

I have been following along a basic tutorial on creating a simple theme structure. I have searched quite a few articles to get an understanding and looked at debugging tips, however I am at a loss, probably due to me limited knowledge base. At this stage I had downloaded bootstrap css and js folders. This is on a local server and I don’t have any plugins installed or activated.

After quite a number of error messages I have come down to this one. Sorry, I don’t remember what changes I made in the functions file to get to this one.

Parse error: syntax error, unexpected ‘,’ in D:\xampp\htdocs\myih\wp-content\themes\mytheme\functions.php on line 8 (line 8 starts at wp_register…..) enter image description here