How to define DRUPAL_WEIGHT_SELECT_MAX? - drupal-7

I have a website powered by drupal, this morning I encountered the following error when i tried to view the block setting.
Notice: Use of undefined constant DRUPAL_WEIGHT_SELECT_MAX - assumed 'DRUPAL_WEIGHT_SELECT_MAX' in form_process_weight() (line 3801 of /home/project-web/career/htdocs/includes/form.inc).
How to address this problem ? thanks in advance.

DRUPAL_WEIGHT_SELECT_MAX is defined in the system.module file. If it's undefined I'd check the integrity of your core Drupal files as it might indicate a bit of a problem.
Just for info it's defined as such:
define('DRUPAL_WEIGHT_SELECT_MAX', 100);

Related

Error on one page that does not appear anywhere else

Hi so my wordpress site has just started acting up, I am not sure if its an update that has caused this but only on this one page I am getting this error regarding
Notice: Array to string conversion in /customers/c/1/7/veganantics.co.uk/httpd.www/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Schemas/ImageAttachmentSchema.php on line 95
I can't seem to find the issue, I have tried replacing the file with a new core file and the error is still there, would really appreciate some help
This is the page: https://veganantics.co.uk/vegan-gifts/
Thank you
Ash
The theme, a plugin or some custom code is probably using the wp_calculate_image_sizes filter and returning an array instead of a string.
Do a text search on your install and look for wp_calculate_image_sizes. The function that you need to find will look similar to
add_filter('wp_calculate_image_sizes', 'something');
Explanation:
ImageAttachmentSchema.php on line 95 is calling wp_get_attachment_image_sizes which must be a string.
wp_get_attachment_image_sizes is returning wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id ) which again must be a string.
wp_calculate_image_sizes returns a filtered value, and that's the only place where such an error (array instead of a string) can happen. So, if the filter incorrectly returns an array, it bubbles up to the function that you see in the error log.

Comparing role positions

Can someone help me?
ERROR: Cannot read property ‘comparePositionTo’ of undefined
Code:
if(message.member.roles.highest.comparePositionTo(message.mentions.members.first().roles.highest) < 1)
Your actual line of code in hastebin has comparePositionsTo instead of comparePositionTo, which is undefined.
The error you gave means that the user that sent the message has no roles.
Also, I highly recommend you do check if the mention is defined or not in your code.
And a 3rd thing - in v12, it's Discord.MessageEmbed(), not Discord.RichEmbed().
Hope this helps!
(sidenote - in the future you should probably copypaste the line of code in question into SO instead of rewriting).

I started to using mothur version - v.1.36.1-, but I got some error messages (shown below). How I can overcome this?

I start the Mothur Tutorial (https://www.mothur.org/wiki/MiSeq_SOP). But from the beginning, I got some error messages when I create " make.file "in mothur*(Error commands are shown below). I changed parameters but the result was negative. How can I solve this problem?
****mothur > make.file(inputdir=MiSeq_SOP, type=fastq, prefix=stability)
Setting input directory to: MiSeq_SOP/
prefix is not a valid parameter.
The valid parameters are: type, seed, inputdir, and outputdir.
[ERROR]: did not complete make.file.****
Actually, the prefix parameter is a valid parameter in mothur. Personally, I have never encountered a problem with using a prefix for the make.file command, but your command should be valid.
You could test if your inputdir is specified correctly (the mothur error and warning messages are not necessarily the most clear ones). If this works as well, I suggest that you well document this behaviour and send it to the mothur team (in my experience, they are quite responsive and ready to help).

How do I get system default checkbox BITMAP in VS2015?

I want to get the system's default checkbox for to display it in an owner-drawn MFC menu.
I have read this question, but that did not answer my question.
I want to implement this line:
hbmpCheckboxes = LoadBitmap((HINSTANCE) NULL,
(LPTSTR) OBM_CHECKBOXES);
which I got from MSDN, section
Simulating Check Boxes in a Menu
I get this error: Error C2065 'OBM_CHECKBOXES': undeclared identifier
If I define it myself: #define OBM_CHECKBOXES 32759, and I run the code, then LoadBitmap returns a handle. In VS2015 I see this: hbmpCheckboxes 0xc305143c {unused=??? }, so to me it seems an invalid bitmaphandle is returned. I think there is more missing than just the OBM_CHECKBOXES define, but I can't figure out what.
Is there a file I should include?
Is there a DLL which I need to link
against?
Is there a project setting I should set?
Or...?
Have a look at this topic.
You want to use CBitmap::LoadOEMBitmap and note the comment at the bottom:
Note that the constant OEMRESOURCE must be defined before including WINDOWS.H in order to use any of the OBM_ constants.

Time page load and display in layout footer

Best solution for timing the page load from as early as possible in the app process, and displaying in the layout footer, without modifying Cake source?
Edited solution. Credit to Everton Yoshitani.
// app/Layouts/default.ctp
echo round(microtime(true) - TIME_START, 3);
Nothing wrong with your code, but if you wanted even more accurate, use a constant inAPP/webroot/index.php right at the top:
<?php
// set a constant for use in app/view/layout/default.ctp
define('MTIME', microtime(true));
/**
* PHP 5
*
and layout:
// see app/webroot/index.php for constant declaration
echo round(microtime(true) - MTIME, 3);
as this file is the very first one accessed (assuming using .htaccess). This relies on you using a constant in an unexpected place.
bootstrap.php is generally the place to put code like this, but a simple comment in your webroot/index.php explaining why the constant is there would clarify any confusion for anyone reading your code.

Resources