Posts

Meaning of `{}` for return expression

15 1 I found by accident that the following compiles: #include <string> #include <iostream> class A{ int i{}; std::string s{}; public: A(int _i, const std::string& _s) : i(_i), s(_s) { puts("Called A(int, const std::string)"); } }; A foo(int k, const char* cstr){ return {k, cstr}; // (*) } int main(){ auto a = foo(10, "Hi!"); return 0; } The line of interest is (*). I guess the function foo is equivalent to: A foo(int k, const char* str){ return A(k, cstr); } However, is there a special name for this mechanism in (*)? Or is it just the simple fact that the compiler knows which constructor to call due to the return type?

cannot import name '_endpoint_from_view_func' from 'flask.helpers' in python

7 I ran the same code on Ubuntu with no problem, but ran it on Windows10 with problems. I also installed Flask. My windows environment is configured as follows: $ pip --version pip 21.1.1 from c:\users\min\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7) $ pip show flask Name: Flask Version: 2.0.0 Summary: A simple framework for building complex web applications. Home-page: https://palletsprojects.com/p/flask Author: Armin Ronacher Author-email: armin.ronacher@active-4.com License: BSD-3-Clause Location: c:\users\min\appdata\local\programs\python\python37\lib\site-packages Requires: Werkzeug, itsdangerous, Jinja2, click Required-by: Flask-RESTful, Flask-API $ pip show flask-restful Name: Flask-RESTful Version: 0.3.8 Summary: Simple framework

How to set initial custom variable date upon datepicker opening in Materialize

7 0 I use two Materialize datepickers. Upon opening the date picker I want the date that in already in html input field to be displayed / used by the date picker. I was thinkig of onOpen callback and there use native .setDate() function. But I got two date pickers and did not find if onOpen accepts any arguments. var datepickerOptions ={ format: 'yyyy-mm-dd', autoClose : "true", firstDay : 1, onOpen : function(arg) { console.log(arg) } } document.addEventListener('DOMContentLoaded', function() { var elems = document.querySelectorAll('.datepicker'); var instances = M.Datepicker.init(elems, datepickerOptions); }); I am using Materialize v1.0. and working jsFiddle is here

How do I create a Field from a value T in jOOQ, explicitly?

16 1 In jOOQ, it is easy to use bind variables in expressions like: MY_TABLE.COL.eq(1); MY_TABLE.COL.in(1, 2, 3); MY_TABLE.COL.between(1).and(10); All of the above methods accept both T and Field<T> types, e.g. Field.eq(T) or Field.eq(Field<T>) . But what if I want to put the bind variable on the left side of the expression? These obviously don't work: 1.eq(MY_TABLE.COL); 1.in(MY_TABLE.COL1, MY_TABLE.COL2, MY_TABLE.COL3); 1.between(MY_TABLE.COL1).and(MY_TABLE.COL2); How can I turn those 1 or "xyz" into Field<Integer> or Field<String> , etc.? (This is such a popular question on the jOOQ mailing list, etc., so I'm documenting it here) java sql jooq

403 Response code - Request Blocked when using Cowin setu APIs

6 1 I was just trying to make covid vaccine alert using Cowin Setu API (India) in nodejs. But I am facing some strange thing, whenever I hit get request I got 403 response code from cloudfront says 'Request Blocked' but the same is working from postman as well as from browser. Please help me in this Getting this error:- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The request could not be satisfied</TITLE> </HEAD><BODY> <H1>403 ERROR</H1> <H2>The request could not be satisfied.</H2> <HR no

Is openJdk upgrading to 8u292 break my aosp build system?

4 Software environment: Ubuntu 20.04 LTS server; Android AOSP 8.0; OpenJDK 8; It works very well util yesterday I upgraded my OpenJDK from 8u282 to 8u292. Now the broken building log says: Ensuring Jack server is installed and started FAILED: setup-jack-server /bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tool

yo @microsoft/sharepoint fails on TypeError: lookups.flatMap is not a function

4 1 After installation of Node v10.16.1 and installation of gulp and yo (Everything looks alright !) it fails on command yo @microsoft/sharepoint with TypeError: lookups.flatMap is not a function C:\Users\MYNAME\AppData\Roaming\npm\node_modules\yo\node_modules\yeoman-environment\lib\resolver.js:70 filePatterns: lookups.flatMap(prefix => [`${prefix}/*/index.ts`, `${prefix}/*/index.js`]), ^ TypeError: lookups.flatMap is not a function at Environment.resolver.lookup (C:\Users\MYNAME\AppData\Roaming\npm\node_modules\yo\node_modules\yeoman-environment\lib\resolver.js:70:27) at init (C:\Users\MYNAME\AppData\Roaming\npm\node_modules\yo\lib\cli.js:130:7) at pre (C:\Users\MYNAME\AppData\Roaming\npm\node_modules\yo\lib\cli.js:89:3)