why wayland-protocol use wl_proxy & wl_resource? - xorg

i don't understand why Wayland-protocol use proxy & resource.
i knew the purpose of using proxy-pattern is saving memory by creating real object only when it’s actually needed. (lazy initialization)
but, Wayland-proxy doesn't do lazy initialization.
Q 1. What's benefit of using proxy & resource?
Q 2. What's purpose of using proxy & resource?
(i tried to reading Wayland-protocol source code, but i don't solve these questions.)

Related

Here API | MultiValueQueryParameter for Via Points

I'm using the latest version of the here javascript sdk 3.1.32.0
When I use H.service.Url.MultiValueQueryParameter for my via points like
{
...,
via: new H.service.Url.MultiValueQueryParameter(['50.1234,8.7654', '51.2234,9.1123']);
}
I see in the URL params of my request this: &via=%5Bobject%20Object%5D
Someone an idea why this happens?
Thanks in advance!
When you use "via" parameter, you define a list of via waypoints. A via waypoint is not a native datatype recongnized by JavaScript, therefore, you will see in the URL params the word object refering to a particular data structure, in this case the via Waypoint composed mainly by Latitude, Longitude.
Regards.
This took a while to figure out the actual issue with the malformed url params. I was dynamically loading the here maps service script on mount of a component. Accidentally this happened in some cases twice. In both cases H was globally available and everything worked like expected. BUT when the script was loaded twice H.service.Url.MultiValueQueryParameter didn't return the correct params. It basically encoded them twice, or tried to.
The other side issue was that https://www.npmjs.com/package/#types/heremaps is outdated and doesn't cover MultiValueQueryParameter. So I had to remove the types and use my own. Else I probably would have realized the issue earlier.

Configure random proxies with R for scraping

I scraped a website authorizing scraping in robots rules but sometimes I get blocked.
While I contacted the admin to understand why, I want to understand how I can use different proxies within R to keep on scraping without being blocked.
I followed this quick tutorial:
https://support.rstudio.com/hc/en-us/articles/200488488-Configuring-R-to-Use-an-HTTP-or-HTTPS-Proxy
So I edited the environment file:
file.edit('~/.Renviron')
and within this I inserted a list of proxies to be selected randomly:
proxies_list <- c("128.199.109.241:8080","113.53.230.195:3128","125.141.200.53:80","125.141.200.14:80","128.199.200.112:138","149.56.123.99:3128","128.199.200.112:80","125.141.200.39:80","134.213.29.202:4444")
proxy <-paste0('https://', sample(proxies_list, 1))
https_proxy=proxy
But when I scrape with this code:
download.file(url_proxy, destfile ='output.html',quiet = TRUE)
html_output <- read_html('output.html')
I keep being blocked.
Am I not setting the proxies correctly?
Thanks !
M.
You need to set environment variables, not R variables. See ?download.file for more details.
eg
Sys.setenv(http_proxy=proxy)
before anything else happens. Also note the warning in the docs:
These environment variables must be set before the download code is
first used: they cannot be altered later by calling 'Sys.setenv'.

sqlite3_key missing from header in iOS 11 framework [duplicate]

I am working on SQLite File Encryption. I have added sqlCipher & crypto frameworks successfully in my project.
Now when I try to compile my application on this line
int rc = sqlite3_key(database, [key UTF8String], strlen([key UTF8String]));
it says Implicit declaration of function 'sqlite3_key'
So above line "implicit declaration" sounds to me like function is defined but not declared. But where I have to declared ?
While searching over Internet, under this article, it says like SQLite Encryption Extension(SEE) is not available publically. I have to purchase it of cost around $2000.
SEE -> http://www.hwaci.com/sw/sqlite/see.html
So this is the only reason I am getting Implicit declaration & False response while sqlite encryption process ?
If you are using SQLCipher, you need to define SQLITE_HAS_CODEC in your application's C Flags. Thats all.
Yes, that is the reason you are getting that compiler warning. The function sqlite3_key() is not defined in the version of libsqlite3 included with iOS. Adding in a function declaration isn't going to help-- it would fix that compiler warning, but it would just mean you'll get a linker error since the function isn't defined anywhere.
If you purchased SEE you could probably build your own copy of SQLite, embed it in your app, and just not use the system's libsqlite3. That this would mean you'd have to say "yes" when the app store submission process asks if your app includes encryption, meaning extra paperwork and time before you could submit the app. I'm not certain whether there's any clear indication of whether Apple would accept it even then-- probably they would, but they've been known to surprise people.

Serving static files using Racket servlets

I'm trying to learn about servers using Racket, and I'm getting caught up on trying to use static assets. From this answer, I was able to include a static stylesheet like so:
#lang racket
(require web-server/servlet
web-server/servlet-env
web-server/configuration/responders)
(define (home req)
(response/xexpr
'(html
(head (link ([rel "stylesheet"] [type "text/css"] [href "/style.css"])))
(body
(span ([class "emph"]) "Hello, world!")))))
(define-values (dispatch input-url)
(dispatch-rules
[("home") home]
[("style.css") (λ (_) (file-response 200 #"OK" "style.css"))]))
(serve/servlet dispatch
#:servlet-regexp #rx""
#:servlet-path "/home"
#:server-root-path (current-directory))
However, I'm still confused as to how to do this in general, i.e. serving all files in #:extra-files-paths without making a dispatch rule for each of them. I tried Jay's advice and changed the dispatcher order in the definition of serve/servlet by moving the htdocs and extra-files-paths parts up (I probably shouldn't copy that whole thing here) and I broke the ability to resolve MIME types somehow. Overall it was a mess.
So any of these questions would be related/relevant to my problem (from less to more general):
Is there a better way to include static files using tools at the level of serve/servlet?
Can anyone outline specifically how I might rearrange the pieces in serve/servlet without breaking things?
Is there a better place than the docs to learn about how to use the lower level server tools in Racket? (I'm pretty new in this particular area so "learn more about servers" may be a valid response to this question)
It looks to me like the problem is your #:servlet-regexp, which is set to the empty regexp, meaning that it will match anything. One easy solution is to restrict this regexp so that it only matches the non-static assets; then, all of the other requests should be served from the #:extra-files-paths.
Perhaps there's some reason why you need to intercept all requests and handle them in your code? Not sure.

Is it possible to intermix Modular templating and legacy VBScript CT?

In particular, the case I have in mind is this:
##RenderComponentPresentation(Component, "<vbs-legacy-ct-tcm-uri>")##
The problem I'm having is that in my case VBS code breaks when it tries to access component fields, giving "Error 13 Type mismatch ..".
(So, if I were to give the answer, I'd say: "Partially, of no practical use")
EDIT
The DWT above is from another CT, so effectively it's a rendering of component link, that's why parameterless overload as per Nuno's suggestion won't work unfortunately. BTW, the following lines inside VBS don't break and give correct values:
WriteOut Component.ID
WriteOut Component.Schema.Title
EDIT 2
Dominic was absolutely wright: it's a missing dependencies.
A bit more insight to make this info generally useful:
Suppose, the original CT looked like this ("VBScript [Legacy]" type):
[%
Call RenderComponent(Component)
%]
This CT was meant to be called from a PT, also VBS-based. That PT had a big chunk of "#include" statements in the beginning.
Now the story changes: the same CT is being called from another, DWT-based, CT. Obviously (thanks you all for your invaluable help!), dependencies are now not being included anywhere.
The solution to make original CT working again is to explicitly hand-pick and include all necessary VBS TBBs, so the original CT becomes:
[%
#include "tcm:<uri-of-vbs-tbb>"
Call RenderComponent(Component)
%]
Yes - it's perfectly possible to mix and match legacy and modular templates. Perhaps obviously, you can't mix and match template building blocks between the two techniques.
In VBScript "Error 13 Type mismatch" is sometimes used as a secret code that really means "I don't recognise the name of one of your variables, (including the names of Functions and Subs)" In the VBScript templating engine, variables from the page template could be in scope in your component template; it was very common, for example, to put the #includes in the PT so they could be used by the CT. My guess is that your component template is trying to use such a Function, and not finding it.
I know that you can render a Modular Page Template with VBScript Component Presentations, and also a VbScript page template can render a modular Component Template.
Your error is possibly due to something else? Have you tried just using the regular ##RenderComponentPresentation()## call without specifying which template?
The Page Template can render Compound Templates of different flavors - for example Razor, VBS, or XSLT.
The problem comes from the TBBs included in the Templates. Often the Razor templates will need to call functions that only exist in VBScript. So, the starting point when migrating templates is always to start with the helper functions and utility libraries. Then migrate the most generic PT / CT you have to the new format (Razor, XSLT, DWT, etc). This provides a nice basis to migrate the rest of the Templates as you have time to the new format.

Resources