Notice: Undefined offset: 0 in smarty - smarty

I got the following notices and would like to clarify:
Notice: Undefined offset: 0 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434
Notice: Undefined offset: 1 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434
Notice: Undefined offset: 2 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434
Notice: Undefined offset: 9 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434
Code lines in the compiled tpl are:
<?php if ($_smarty_tpl->tpl_vars['TablesLinked']->value[$_smarty_tpl->getVariable('smarty')->value['section']['i']['index']]){?>
This is the uncompiled line:
{if $TablesLinked[i]}
One line above starts the section:
{section name=i loop=$NumberFields}
Do I have to change the start index because offset means wrong index ?
TablesLinked does not appear in every field, because fields consist of linkedtables and normal fields, thats why I use an if-clause.
I hope you can help.

Although it is a very good practice set error_reporting to E_ALL during development phase and trying to eliminate all notices, personally I wouldn't worry about these messages. It just won't find the elements on the specified indices during the loop. In any case, if you insist on eliminating the notices, you can change
{if $TablesLinked[i]}
to
{if isset($TablesLinked[i]) && $TablesLinked[i]}

Related

how to limit 00 to 99 counter to 60

For a simple starter project I was putting together a 2-7segement display 00 to 99 counter coded on sketch.
//The line below is the array containing all the binary numbers for the digits on a SSD from 0 to 9
const int number[11] = {0b1000000, 0b1111001, 0b0100100, 0b0110000, 0b0011001, 0b0010010, 0b0000010, 0b1111000, 0b0000000, 0b0010000};
I believe that my solution is either to change this part of the code or add another line, I'm just unsure.
Any advice?
I have tried adding another line to set one of the displays to stop at 6 but it didn't compile with the rest of the code.

JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0) ---While Tuning gpt2.finetune

Hope you all are doing good ,
I am working on fine tuning GPT 2 model to generate Title based on the content ,While working on it ,I have created a simple CSV files containing only the title to train the model , But while inputting this model to GPT 2 for fine tuning I am getting the following ERROR ,
JSONDecodeError Traceback (most recent call last)
in ()
10 steps=1000,
11 save_every=200,
---> 12 sample_every=25) # steps is max number of training steps
13
14 # gpt2.generate(sess)
3 frames
/usr/lib/python3.7/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
336 if s.startswith('\ufeff'):
337 s = s.encode('utf8')[3:].decode('utf8')
--> 338 # raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)",
339 # s, 0)
340 else:
JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
Below is my code for the above :
import gpt_2_simple as gpt2
model_name = "120M" # "355M" for larger model (it's 1.4 GB)
gpt2.download_gpt2(model_name=model_name) # model is saved into current directory under /models/117M/
sess = gpt2.start_tf_sess()
gpt2.finetune(sess,
'titles.csv',
model_name=model_name,
steps=1000,
save_every=200,
sample_every=25) # steps is max number of training steps
I have tried all the basic mechanism of handing UTF -8 BOM but did not find any luck ,Hence requesting your help .It would be a great help from you all .
Try changing the model name because i see you input 120M and the gpt2 model is called 124M

ErrorException in class.pdf.php line 3154

I'm new in Laravel, I use laravel 5.2 and I'm trying to generate a report using DomPdf but I'm getting error:
ErrorException in class.pdf.php line 3154
Undefined index:
in class.pdf.php line 3154
at HandleExceptions->handleError('8', 'Undefined index: ', 'C:\xampp\htdocs\balai\vendor\dompdf\dompdf\lib\class.pdf.php', '3154', array('size' => '12')) in class.pdf.php line 3154
at Cpdf->getFontHeight('12') in cpdf_adapter.cls.php line 740
at CPDF_Adapter->get_font_height('C:/xampp/htdocs/balai/vendor/dompdf/dompdf/lib/fonts/Times-Roman', '12') in font_metrics.cls.php line 122
at Font_Metrics::get_font_height('C:/xampp/htdocs/balai/vendor/dompdf/dompdf/lib/fonts/Times-Roman', '12') in text_frame_reflower.cls.php line 167
at Text_Frame_Reflower->_layout_line() in text_frame_reflower.cls.php line 332
at Text_Frame_Reflower->reflow(object(Block_Frame_Decorator)) in frame_decorator.cls.php line 711
at Frame_Decorator->reflow(object(Block_Frame_Decorator)) in block_frame_reflower.cls.php line 750
at Block_Frame_Reflower->reflow(null) in frame_decorator.cls.php line 711
at Frame_Decorator->reflow() in page_frame_reflower.cls.php line 123
at Page_Frame_Reflower->reflow(null) in frame_decorator.cls.php line 711
at Frame_Decorator->reflow() in dompdf.cls.php line 973
at DOMPDF->render() in PDF.php line 208
at PDF->render() in PDF.php line 154
at PDF->output() in PDF.php line 166
at PDF->save('documents.pdf') in LlajRambuController.php line 247
at LlajRambuController->printRambu('52', '1')
I was having this same problem, and I found a solution that makes no sense to me.
The HTML I was passing to dompdf didn't have any line breaks, like:
<html><body>content here<body></html>
Adding a break after the body tag fixed the problem.
<html><body>
content here
</body></html>
No clue what's going on, but now it works. Hope this fixes your problem too.

Checking if pixel belongs to an image

I have written the following function that find if a pixel belongs to an image in matlab.
At the beginning, I wanted to test it as if a number in a set belongs to a vector like the following:
function traverse_pixels(img)
for i:1:length(img)
c(i) = img(i)
end
But, when I run the following commands for example, I get the error shown at the end:
>> A = [ 34 565 456 535 34 54 5 5 4532 434 2345 234 32332434];
>> traverse_pixels(A);
??? Error: File: traverse_pixels.m Line: 2 Column: 6
Unexpected MATLAB operator.
Why is that? How can I fix the problem?
Thanks.
There is a syntax error in the head of your for loop, it's supposed to be:
for i = 1:length(img)
Also, to check if an array contains a specific value you could use:
A = [1 2 3]
if sum(A==2)>0
disp('there is at least one 2 in A')
end
This should be faster since no for loop is included.
for i = 1:length(image)
silly error, not : , it is =

ruby YAML parse bug with number

I have encountered what appears to be a bug with the YAML parser. Take this simple yaml file for example:
new account:
- FLEETBOSTON
- 011001742
If you parse it using this ruby line of code:
INPUT_DATA = YAML.load_file("test.yml")
Then I get this back:
{"new account"=>["FLEETBOSTON", 2360290]}
Am I doing something wrong? Because I'm pretty sure this is never supposed to happen.
It is supposed to happen. Numbers starting with 0 are in octal notation. Unless the next character is x, in which case they're hexadecimal.
07 == 7
010 == 8
011 == 9
0x9 == 9
0xA == 10
0xF == 15
0x10 == 16
0x11 == 17
Go into irb and just type in 011001742.
1.9.2-p290 :001 > 011001742
=> 2360290
PEBKAC. :)
Your number is a number, so it's treated as a number. If you want to make it explictly a string, enclose it into quotes, so YAML will not try to make it a number.
new account:
- FLEETBOSTON
- '011001742'

Resources