Change string to date in Rstudio not working for me :-( - as.date

I am working on a string that looks like this: 2021-04-16T07:37:13.670549 and have tried using as.Date(x, format="%Y-%m-%d %H:%M:%S",tz="UTC") in R but its not working. Can someone tell me what i am doing wrong? Thank you.

Related

Regex specific question and search function on my website dealing with broken links

I've been trying to figure out my regex pattern but it doesn't seem to be working for me.
Here's what i'm trying to do:
I have broken links on my website if someone accidentally gets to a page like so:
https://example.com/catalogsearch/result/?q=
or
https://example.com/catalogsearch/result/
So i'm redirecting them back to my homepage. The problem is now the search is just sending everything back to the homepage. So i'm assuming if there is something after the equals it needs to continue the search.. obviously
https://example.com/catalogsearch/result/?q=person
but currently i can't figure this out..
Here is my regex that i've been messing with for quite sometime now... still seems to be wrong or something else is wrong with my search.
"^/catalogsearch/result((/)|(/\\?)|(/\\?[a-z])|(/\\?[a-z]=))?$"
Please forgive me i'm horrible with regex.
After a lot of discussion, it is concluded that the routes.yaml will consider the url path as a valid route but not the query string part. Hence out of the two examples in the post, you can use
"/catalogsearch/result": { to: "https://example.com/", prefix: false }
and for other one please change it in nginx config to redirect to homepage or if its not possible then check with magento support on how to incorporate the query string part in routes.yaml file.

Is there an example of a multiline text field in GTK+3 written in c++ without using css?

I'm having trouble figuring out the basic multi-line text field stuff in GTK+3. I was hoping someone could help me out with a simple example with no css formatting. I've done some googling and haven't found anything which I wouldn't have to deconstruct to get at the answer. Thanks.
Alright, I figured out how to do it.
GtkTextBuffer *textBufferName = gtk_text_buffer_new(NULL);
GtkWidget *widgetName = gtk_text_view_new_with_buffer(textBufferName);

Server Side Includes are not being shown

I've gone through every fix online I'm pretty sure but I just can't seem to get this to work. I'm trying to have <#include virtual="footer.ssi" but not matter what it doesn't work.
footer.ssi and the page are in the same place
I really have no clue how to fix this issue but I can't get ANY server sides to show up on any of my pages so I know it's on my end. If anyone has any thoughts they're greatly appreciated!
I believe your code should be this: <!--#include virtual="footer.ssi" -->, this is what I use on my website, and it works perfectly!
See this reference: Html Goodies, and scroll down to The File Argument section.

Converting russian string to datetime

I am trying to scrape a russian website. However i am stuck with trying to convert a russian cyrillic to DateTime object.
Let's take this html piece for example:
<div class="medium-events-list_datetime">22 января весь день</div>
I am able fetch the content of this div by using lxml, i.e:
date = root.xpath('/html/body/div[1]/div/div[2]/text()')[0].strip()
So the relevant part of of this string is 22 января, which is day and a month.
To get this part i am using the .split() method
Now here lies the problem, i am trying to convert this into DateTime.
I try to use DateParser: https://dateparser.readthedocs.org/en/latest/
,which is supposed to support russian.
However it returns None when i pass this string to dateparser.parse()
Did anyone run into similar issue? I am banging my head against the wall on this one. Any help appreciated :)
try running this example:
#coding=utf-8
import dateparser
s = u"22 января"
print dateparser.parse(s)
It should output 2016-01-22 00:00:00
Important: Make sure that you're actually using utf-8 strings. More info: https://www.python.org/dev/peps/pep-0263/
Otherwise your parsing/splitting might be wrong, so try having a look at the results after the split().

GetFullUrl doesn't return the complete url - sitecore

I am trying to get a fully qualified url, here is the code
string path = string.Format("/sitecore/shell/Applications/Content%20Manager/default.aspx?id={0}&la={1}&fo={0}", contentItem.ID, contentItem.Language);
string fullPath = Sitecore.Web.WebUtil.GetFullUrl(path);
text = text.Replace("$itemUrl$", fullPath);
This returns something like this http://cp.localsite/sitecore/shell/Applications/Content%20Manager/default.aspx?id={DC6B4AE0-929D-4F19-97F4-825796A30781}&la=en&fo={DC6B4AE0-929D-4F19-97F4-825796A30781}
This is generated like a link till ?id= from the id it looks like a normal text. How can i resolve this.I want clickable url for the content. I really appreciate any help.
Thanks.
could you please give a bit more context around what you are trying to achieve. The described behavior is correct, but it is obviously not what you were hoping to achieve.
UPDATED:
Looks like you are on the right track, the only thing i noticed is that you could really get away with just using the fo querystring to get to the right item, you could also use the other ones mentioned here Custom email notification with link - sitecore to get more specific.
For the reason the url being cut off at the id= is that the text parser probably does not like the curly brakets - try encoding the URL and see if that works.
text = HttpUtility.UrlEncode(text);