What kind of syntax is this? - syntax

I assume it is some serialized version of an html form, but past that...
O:15:"ColoradoReindeer":23:{s:8:"repID";i:166;s:10:"*created";N;s:9:"slumber";s:7:"2398863";s:10:"cucumber";s:10:"73100.000";s:4:"name";s:8:"Test PTO";s:7:"company";s:12:"Test Company";s:7:"address";s:35:"1120 Avenue of the Test, 16th Floor";s:4:"city";s:8:"New York";s:5:"state";s:2:"NY";s:3:"zip";s:5:"10036";s:5:"phone";s:12:"212 555 5555";s:5:"email";s:17:"aa#example.com";s:12:"serialnumber";s:7:"testing";s:14:"dateofpurchase";s:0:"";s:7:"product";s:7:"testing";s:11:"accessories";s:7:"testing";s:9:"packaging";s:44:" Lorem ipsum dolor sit amet, consectetur adipiscing elit..";s:15:"troublereported";s:7:"testing";s:6:"backup";s:34:" Lorem ipsum dolor sit amet, consectetur adipiscing elit..";s:8:"estimate";s:0:"";s:19:"*packagingOptions";a:4:{i:0;s:0:"";i:1;s:25:" Lorem ipsum dolor sit amet, consectetur adipiscing elit.";i:2;s:44:" Lorem ipsum dolor sit amet, consectetur adipiscing elit.";i:3;s:39:"Computer is generic.";}s:16:"*bOptions";a:4:{i:0;s:0:"";i:1;s:71:" Lorem ipsum dolor sit amet, consectetur adipiscing elits.";i:2;s:34:"Not accessible.";i:3;s:52:" Lorem ipsum dolor sit amet, consectetur adipiscing elit.";}s:15:"delivery_method";s:17:"They will deliver";}

It looks like the output of the serialize() function from PHP. In this case, it is not syntactically correct.

Related

XPath targeting specific child and grandchild (child of child)

I am trying to target all the p tags, where there is no strong tag as a child or grandchild(child of the child) of the p tag.
here is the sample
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. <a>Lorem ipsum dolor sit amet consectetur, adipisicing elit.</a>
</p>
<p>
<strong>Lorem ipsum dolor sit amet consectetur, adipisicing elit. <a>Lorem ipsum dolor sit amet consectetur, adipisicing elit.</a></strong>
</p>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. <a><strong>Lorem ipsum dolor sit amet consectetur, adipisicing elit.</strong></a>
</p>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. <a>Lorem ipsum dolor sit amet consectetur, adipisicing elit.</a>
</p>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. <a><strong>Lorem ipsum dolor sit amet consectetur, adipisicing elit.</strong></a>
</p>
In the above code, the 2nd, 3rd, and last one are the ones that I don't want but I want the rest of them. I have gotten as far as this XPath:
//p[not(child::strong)] which removes the 2nd paragraph, but when i add the a>strong like //p[not(child::strong) or not(child::a > strong)] the second part is being ignored. Can anyone point out where am I going wrong and how to fix this issue?
You want //p[not(strong) and not(*/strong)].

My web site's links are not working (404 NOT FOUND) on my server

My web site's links are not working.
My site : https://overlap.ulb.be/public/
When I click on a link, I have a 404 NOT FOUND (on any link)
If I click on the link "à propos" (about), I have this link :
https://overlap.ulb.be/about
We can see that I don't have anymore the public name in the URL.
This is a part of my code (routes)
Route::get('about', [PlanteController::class, 'about']);
and the controller code :
public function about()
{
return view('phyto.about' );
}
And the view's code :
<x-phyto-layout>
<style>
.h4-about-first {
margin: 0 0 10px 0;
}
.h4-about-m20 {
margin: 20px 0 10px 0;
}
.h4-about {
font-family: "Lato", Helvetica, Verdana, sans-serif;
/*font-family: "Arial Rounded MT Bold", Helvetica, Verdana, sans-serif;*/
font-weight: 500;
line-height: 120%;
padding: 0;
/*padding-left: 0px;*/
/*margin: 0 0 10px;*/
/*color: #413d3d;*/
color: rgba(0, 0, 0, 0.5);
}
.h4-about {
font-size: 22px;
}
.p-about {
font-family: "Lato", Helvetica, Verdana, sans-serif;
font-size: 14px;
font-weight: 300;
line-height: 24px;
color: #413d3d;
/*margin: 0 0 18px 0;*/
margin: 0 !important;
padding: 0;
/*padding-left: 0px;*/
}
</style>
<!-- About page container -->
<div class="page-container">
<div class="bloc bloc-fill-screen l-bloc" id="bloc-7">
<div class="container fill-bloc-top-edge">
<div class="row">
<div class="bloc l-bloc" id="bloc-13" style="">
<div class="container bloc-lg">
<div class="row">
<div class="col">
{{--<h3 style="font-size: 24px !important" class="mg-md h3-style">À propos de nous</h3>--}}
<h4 class="h4-about h4-about-first">À propos de nous</h4>
<p class="p-about" {{--style="color:black !important"--}}>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium adipisci alias aliquid at aut ea
eligendi, enim esse ex excepturi in ipsam neque odio praesentium repellendus sed tenetur totam unde.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium adipisci alias aliquid at aut ea
eligendi, enim esse ex excepturi in ipsam neque odio praesentium repellendus sed tenetur totam unde.
</p>
{{--<h3 style="padding-top: 24px;font-size: 24px !important" class="mg-md h3-style">Projet Phyto ?</h3>--}}
<h4 class="h4-about h4-about-m20">Projet Phyto ?</h4>
<p class="p-about" {{--style="color:black !important"--}}>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium adipisci alias aliquid at aut ea
eligendi, enim esse ex excepturi in ipsam neque odio praesentium repellendus sed tenetur totam unde.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium adipisci alias aliquid at aut ea
eligendi, enim esse ex excepturi in ipsam neque odio praesentium repellendus sed tenetur totam unde.
</p>
{{--<h3 style="padding-top: 24px;font-size: 24px !important" style="padding-top: 30px" class="mg-md h3-style">Collaborateurs</h3>--}}
<h4 class="h4-about h4-about-m20">Collaborateurs</h4>
<p class="p-about" {{--style="color:black !important"--}}>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium adipisci alias aliquid at aut ea
eligendi, enim esse ex excepturi in ipsam neque odio praesentium repellendus sed tenetur totam unde.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium adipisci alias aliquid at aut ea
eligendi, enim esse ex excepturi in ipsam neque odio praesentium repellendus sed tenetur totam unde.
</p>
<h4 class="h4-about h4-about-m20">Nom latin</h4>
<p class="p-about" {{--style="color:black !important"--}}>
Le nom latin fait référence à la dernière classification (lien : www.derniere-classification.org)
</p>
<a href="/gpd?p=search" class="btn btn-lg btn-more-link-style btn-sq btn-golden-green float-lg-none mt-5">
Recherche de plantes
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- bloc-7 END -->
Thank you
{{--<div class="bloc none l-bloc" id="home-about">
<div class="container bloc-xl">
<div class="row">
<div class="col-md-2 order-md-1">
<img src="/images/valeriane_rouge.jpg" data-src="/images/valeriane_rouge.jpg" class="img-fluid mx-auto d-block lazyloaded">
</div>
<div class="col-md-2 align-self-center">
<h2 class="mg-md titulo01 h2-margin-bottom">Qu'est ce que ULB-PHYTO?</h2>
<p class="parrafo01">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus dicta error explicabo,
harum hic ipsam laboriosam molestiae nihil odit optio porro provident repellendus
saepe sed sequi similique velit vitae, voluptatem?
Lorem ipsum dolor sit amet, consectetur adipisicing elit. A accusantium amet delectus,
dicta dolor ea eligendi ex, excepturi facere
incidunt iste maiores porro possimus, qui rerum velit vitae voluptatem! Repudiandae.
</p>
</div>
</div>
</div>
</div>--}}
I also have a .htaccess :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
your issue was not loading your asset correctly. you can put the full URL of styles and javascript in your app layout including the public or you can use the asset function to generate a URL for an asset using the current scheme of the :
<link rel="stylesheet" type="text/css" href="{{asset('css/style.css')}}">
if you are using the asset method you should put the ASSET_URL variable in your .env file
ASSET_URL=https://overlap.ulb.be/public
UPDATED
if you mean images in your style you have two solutions, you can write inline style in your blade in this case you can use the asset method like the above example OR change all background URLs in the external style CSS file with
background-image: url("/public/images/...");

ckeditor highlighting content of div and deleting also deletes the div

I use the templates plugin for my ckeditor and I input a 2 column structure like this:
<div class="row">
<div class="two_col half">
<p>Info Block One. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et m. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.</p>
</div>
<div class="two_col half">
<p>Info Block Two. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et m. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.</p>
</div>
</div>
My content editors then edit the content of each div and input whatever text they need to.
The issue I'm having is that when my editors highlight the lorem ipsum text and delete it to start their content, the delete action also deletes the actual div itself, resulting in this:
<div class="row">
<div class="two_col half">
<p>Info Block One. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et m. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.</p>
</div>
</div>
Is there something I can do to stop that from happening, I would like the div to remain after the user deletes the lorem ipsum placeholder text.
I'm using version 4.5.4
I don't know how to prevent it from the CK Editor perspective, but from Kentico point of view, you can style the template to have two Editable texts next to each other for those two columns. You can either have two web part zones - one editable text per each or two texts in one zone.

Format (line length) of javadoc (or other) comments

Is there a convention saying how long a line of comment should be?
Different line lengths will not work for any monitor size, or even font size, and other collaborators reading the code will have to scroll back and forth horizontally to read the entire line. I am wondering how this type of stuff is solved in the real world where people collaborate with other coders. Or is there some kind of auto formatter where people can change this kind of stuff on-the-fly to their own taste maybe?
For example:
/**
* Lorem ipsum dolor sit amet, consectetur
* adipisicing elit. Libero pariatur maxime
* praesentium. Similique qui, non aliquam
* nulla libero tenetur voluptatibus delectus,
* ex ab, aspernatur nam animi ipsa. Beatae
**/
versus:
/**
* Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam iste magni optio
* impedit rem labore minima cumque quaerat corrupti suscipit dicta, possimus commodi
* laudantium ipsam, tenetur. Omnis qui, veritatis eligendi dignissimos rem quos
* voluptatum quaerat neque at excepturi quod fugit veniam sapiente sunt blanditiis,
* autem illum alias delectus illo, nostrum, dolore aspernatur culpa. Omnis ea deserunt,
* vero odio praesentium repellendus enim recusandae at temporibus officia, obcaecati
**/
(I apologise if this is the wrong stackexchange site to ask this, I honestly didn't know where to put it)

Removing <p> elements with no text with Nokogiri

Given an HTML document in Nokogiri, I want to remove all <p> nodes with no actual text. This includes <p> elements with whitespace and/or <br/> tags. What's the most elegant way to do this?
This is a simpler fix: it removes both the whitespace and the br tags.
given the HTML
"<p> </p><p>Foo<p/><p><br/> <br> </p>"
Solution:
document.css('p').find_all.each do |p|
# Ruby on Rails Solution:
p.remove if p.content.blank?
# Ruby solution, as pointed out by Michael Hartl:
p.remove if p.content.strip.empty?
end
# document => <p>Foo</p>
I would start with a method like this one (feel free to monkeypatch Nokogiri::XML::Node if you want to)
def is_blank?(node)
(node.text? && node.content.strip == '') || (node.element? && node.name == 'br')
end
Then continue with another method that checks that all children are blank:
def all_children_are_blank?(node)
node.children.all?{|child| is_blank?(child) }
# Here you see the convenience of monkeypatching... sometimes.
end
And finally, get the document and
document.css('p').find_all{|p| all_children_are_blank?(p) }.each do |p|
p.remove
end
There's a more elegant way:
require "nokogiri"
doc = Nokogiri::HTML.parse <<-EOHTML
<div>
<p class="empty_p"></p>
<p class="full_p">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
EOHTML
# Magic happens here...
doc.at_css("p:first-child:empty").remove
puts doc.to_html

Resources