'flutter' doesnt recognize as a name in cmdlet - json

im following a tutorial of flutter about using json and serialization.
Im trying to execute a command in the terminal in a flutter proyect in vscode,
this is the class
import 'package:json_annotation/json_annotation.dart';
part 'mensaje.g.dart';
#JsonSerializable()
class Mensaje{
final String subject;
final String body;
Mensaje(this.subject,this.body);
Mensaje.fromJson(Map<String, dynamic> json):
subject=json['subject'],
body=json['body'];
}
I first add the dependecies in pubspec.yaml:
dev_dependencies:
build_runner:
json_serializable:
then i try to execute in the terminal in vscode this line:
flutter packages pub run build_runner build
and the error:
(flutter its not recognize as a cmdlet name or function... )
flutter : El término 'flutter' no se reconoce como nombre de un cmdlet, función,
archivo de script o programa ejecutable. Compruebe si escribió correctamente el
nombre o, si incluyó una ruta de acceso, compruebe que dicha ruta es correcta e
inténtelo de nuevo.
En línea: 1 Carácter: 1
+ flutter packages pub run build_runner build
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (flutter:String) [], CommandNotFoundEx
ception
+ FullyQualifiedErrorId : CommandNotFoundException

It seems that you need to add your Flutter SDK path to the environment variable (e.g. C:\src\flutter) for windows. Also you can follow the Flutter documentation for proper installation on different OS:
Windows
macOS
linux
Chrome OS
If this is not the case, you can try to restart your VSCode application.

Related

web3py EthereumTesterProvider - Basic interactions with a smart contract fail

On the web3py EthereumTesterProvider blockchain, I tested the contract deployment example at https://web3py.readthedocs.io/en/v5/contracts.html.
But I came across 2 errors.
pip config (windows 10) :
web3py (5.31.3)
eth-tester (0.8.0b3)
Here is the code :
from web3 import Web3
from solcx import compile_source
from pprint import pprint
# Solidity source code
compiled_sol = compile_source(
'''
pragma solidity ^0.8.17;
contract Greeter {
string public greeting;
constructor() public {
greeting = 'Hello';
}
function setGreeting(string memory _greeting) public {
greeting = _greeting;
}
function greet() view public returns (string memory) {
return greeting;
}
}
''',
output_values=['abi', 'bin']
)
# retrieve the contract interface
contract_id, contract_interface = compiled_sol.popitem()
# get bytecode and abi
bytecode = contract_interface['bin']
abi = contract_interface['abi']
# web3.py instance
w3 = Web3(Web3.EthereumTesterProvider())
# set pre-funded account as sender
w3.eth.default_account = w3.eth.accounts[0]
greeter_bin = w3.eth.contract(abi=abi, bytecode=bytecode)
# Submit the transaction that deploys the contract
tx_hash = greeter_bin.constructor().transact() # <==== first error
# tx_hash = greeter_bin.constructor().transact({'gas': 123456})
# Wait for the transaction to be mined, and get the transaction receipt
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
pprint(dict(tx_receipt))
greeter_obj = w3.eth.contract(address=tx_receipt.contractAddress, abi=abi)
print(f"{greeter_obj.functions.greet().call() = }") # <===== Second error
tx_hash = greeter_obj.functions.setGreeting('Nihao').transact()
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print(f"{greeter_obj.functions.greet().call() = }")
1) The first error takes place at the contract deployment:
"TypeError: MockBackend.estimate_gas() takes 2 positional arguments but 3 were given."
I fixed it by adding a dictionary with some gas but the exemple from Web3.py does not have this parameter. I'd like to know the reason. Did I miss something?
C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_tester\backends\__init__.py:30: UserWarning: Ethereum Tester: No backend was explicitly set, and no *full* backends were available. Falling back to the `MockBackend` which does not support all EVM functionality. Please refer to the `eth-tester` documentation for information on what backends are available and how to set them. Your py-evm package may need to be updated.
warnings.warn(
Traceback (most recent call last):
File "D:\_P\dev\python\blockchain\web3\tester1.py", line 45, in <module>
tx_hash = greeter_bin.constructor().transact()
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_utils\decorators.py", line 18, in _wrapper
return self.method(obj, *args, **kwargs)
.............
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\providers\eth_tester\middleware.py", line 331, in middleware
return make_request(method, [filled_transaction] + list(params)[1:])
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\middleware\formatting.py", line 94, in middleware
response = make_request(method, params)
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\providers\eth_tester\main.py", line 103, in make_request
response = delegator(self.ethereum_tester, params)
File "cytoolz\functoolz.pyx", line 253, in cytoolz.functoolz.curry.__call__
File "cytoolz\functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\providers\eth_tester\defaults.py", line 66, in call_eth_tester
return getattr(eth_tester, fn_name)(*fn_args, **fn_kwargs)
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_tester\main.py", line 483, in estimate_gas
raw_gas_estimate = self.backend.estimate_gas(raw_transaction, raw_block_number)
TypeError: MockBackend.estimate_gas() takes 2 positional arguments but 3 were given
2) After fixing the first error by adding {'gas': 123456} in transact(), the second error takes place at greeter_obj.functions.greet().call() :
"ValueError: Error expected to be a dict."
For this one, I have no clue
Information�: impossible de trouver des fichiers pour le(s) mod�le(s) sp�cifi�(s).
C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\eth_tester\backends_init_.py:30: UserWarning: Ethereum Tester: No backend was explicitly set, and no full backends were available. Falling back to the MockBackend which does not support all EVM functionality. Please refer to the eth-tester documentation for information on what backends are available and how to set them. Your py-evm package may need to be updated.
warnings.warn(
{'blockHash': HexBytes('0xafae7675633fedae22a1f5b9d11066ff78de5947f7b3e2915824823cc65d0e56'),
'blockNumber': 1,
'contractAddress': '0xa0Beb7081fDaF3ed157370836A85eeC20CEc9e04',
'cumulativeGasUsed': 21000,
'effectiveGasPrice': 1000000000,
'from': '0xaBbACadABa000000000000000000000000000000',
'gasUsed': 21000,
'logs': [],
'state_root': b'\x00',
'status': 0,
'to': '',
'transactionHash': HexBytes('0x5193460ead56b33c2fa79b490a6c0f4e0d68e07c712d762afcadc5976148bf1a'),
'transactionIndex': 0,
'type': '0x2'}
Traceback (most recent call last):
File "D:_P\dev\python\blockchain\web3\tester1.py", line 54, in
print(f"{greeter_obj.functions.greet().call() = }")
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\contract.py", line 970, in call
return call_contract_function(
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\contract.py", line 1525, in call_contract_function
return_data = web3.eth.call(
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\manager.py", line 198, in request_blocking
return self.formatted_response(response,
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\manager.py", line 170, in formatted_response
apply_error_formatters(error_formatters, response)
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3\manager.py", line 70, in apply_error_formatters
formatted_resp = pipe(response, error_formatters)
File "cytoolz\functoolz.pyx", line 666, in cytoolz.functoolz.pipe
File "cytoolz\functoolz.pyx", line 641, in cytoolz.functoolz.c_pipe
File "C:\Users\Gilles\AppData\Local\Programs\Python\Python310\lib\site-packages\web3_utils\method_formatters.py", line 555, in raise_solidity_error_on_revert
raise ValueError('Error expected to be a dict')
ValueError: Error expected to be a dict
Please note the status of the deployment transaction: 'status': 0
It failed but a contractAddress was returned !
As far as the UserWarning is concerned, I also tried unsuccessfully MockBackend (though it's the default backend):
from eth_tester import MockBackend
w3 = Web3(Web3.EthereumTesterProvider(MockBackend()))
Lastly, I tried to install py-evm "pip install py-evm" to try PyEVMBackend backend, but the installation failed at pyethash dependency:
"D:\Program\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\Gilles\AppData\Local\Programs\Python\Python310\include -IC:\Users\Gilles\AppData\Local\Programs\Python\Python310\Include "-ID:\Program\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-ID:\Program\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcsrc/libethash/io_win32.c /Fobuild\temp.win-amd64-cpython-310\Release\src/libethash/io_win32.obj -Isrc/ -std=gnu99 -Wall
clÿ: Ligne de commande warning D9002ÿ: option '-std=gnu99' inconnue ignor‚e
io_win32.c
c1: fatal error C1083: Impossible d'ouvrir le fichier sourceÿ: 'src/libethash/io_win32.c'ÿ: No such file or directory
error: command 'D:\\Program\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pyethash

How to fix "Failed to obtain JDBC Connection" datasource error in my java application

I have a little training project running under Java Spring MVC and using MySQL on WAMP Server), it was working but i cloned it and had to reinstall database (restored from a dump) and Wamp64 also, but now my java application cannot connect and i get different errors.
In IntelliJ IDEA when i test the connection to the database, the connection is successfull, even in phpmyadmin, but not when i launch my application.
jdbc:mysql://localhost:3306/library?serverTimezone=UTC (i had to use server timezone to fixe timezone error)
It's looking like my java app doesn't use the good datasource configuration, and instead use the old one but i can't figure out why.
My application is using SOAP protocol to connect to my webservices.
The main error is a javaNullPointer exception on the line where i try to get the user from database trough an input form.
The other error is (when i go in debug mode):
Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Accès refusé pour l'utilisateur: 'root'#'#localhost' (mot de passe: OUI) error.
This project was cloned from an old project. I suppose there is somewhere an old datasource used by the application.
It looks like my application uses old login settings for mysql (login: root, password: password). I recently changed the login information to my database, to an "admin_library" login that has all the privileges and a password.
I invalidated and restarted the IntelliJ cache, made an "mvn clean install", but when I run my two tomcat servers (one for the webservice, another one for the soap webserviceclient), my login screen appears but I have a null point exception (apparently due to a database connection problem.
Here is my configuration:
pom.xml:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>
WEB-INF/SpringMVCDispatcher-servlet.xml:
<!-- CONFIG JDBC DATASOURCE // -->
<bean id = "jdbcTemplate"
class = "org.springframework.jdbc.core.JdbcTemplate">
<property name = "dataSource" ref = "dataSource" />
</bean>
<bean id = "dataSource"
class = "org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name = "driverClassName" value = "com.mysql.jdbc.Driver"/>
<property name = "url" value = "jdbc:mysql://localhost:3306/library"/>
<property name = "username" value = "admin_library"/>
<property name = "password" value = "password"/>
</bean>
Type Rapport d'exception
message Request processing failed; nested exception is com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Accès refusé pour l'utilisateur: 'root'#'#localhost' (mot de passe: OUI) Please see the server log to find more detail regarding exact cause of the failure.
description Le serveur a rencontré une erreur interne qui l'a empêché de satisfaire la requête.
exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Accès refusé pour l'utilisateur: 'root'#'#localhost' (mot de passe: OUI) Please see the server log to find more detail regarding exact cause of the failure.
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:901)
javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
cause mère
com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Accès refusé pour l'utilisateur: 'root'#'#localhost' (mot de passe: OUI) Please see the server log to find more detail regarding exact cause of the failure.
com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:193)
com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:128)
com.sun.xml.ws.client.sei.StubHandler.readResponse(StubHandler.java:253)
com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:206)
com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:293)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)
com.sun.proxy.$Proxy47.findByEmail(Unknown Source)
fr.projet3.library.controller.LoginController.postLogin(LoginController.java:57)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:566)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:215)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:142)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:901)
javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de ce serveur.
A look into the controller:
#PostMapping(value = {"/login","/", ""})
public String postLogin(#Valid #ModelAttribute("userLoginForm")UserLoginForm userLoginForm, BindingResult bindingResult, ModelMap modelMap, HttpSession session){
if(!bindingResult.hasErrors()){
UserWS u = libraryWS.findByEmail(userLoginForm.getEmail());
if(u == null){
return "login";
}
session.setAttribute("currentUser", u);
return "redirect:/userloan";
}
return "login";
}
I had to edit an "applicationContext.xml" file also for the libraryWS. Then i got a timezone error:
Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: The server time zone value 'Paris, Madrid (heure dété)' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
i fixed this error also using:
?zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=UTC to my datasource connexion EG: jdbc:mysql://localhost:3306/library?zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=UTC"

How to make chrome devtools to recognise moment.js

I am working on ionic2 project. I have just start using moment.js but I have a weird issue.
I have installed in via npm: npm install moment -S.
Then I have used it in my code:
import moment from 'moment'
...
let x = moment()
debugger
On the console I get this funny issue:
> x
< Moment {_isAMomentObject: true, _isUTC: false, _pf: {…}, _locale: Locale, _d: Wed Jun 27 2018 12:06:23, …}
> y = moment()
< VM770:1 Uncaught ReferenceError: moment is not defined
at eval (eval at Phase (phase.ts:13), <anonymous>:1:1)
at new Phase (phase.ts:13)
at new Stage (stage.ts:10)
at new HomePage (home.ts:39)
at createClass (core.es5.js:10795)
at createDirectiveInstance (core.es5.js:10621)
at createViewNodes (core.es5.js:11971)
at createRootView (core.es5.js:11876)
at callWithDebugContext (core.es5.js:13007)
at Object.debugCreateRootView [as createRootView] (core.es5.js:12468)
Why can't I work with moment within the console?
Could fetch it from browser console like this:
fetch('https://momentjs.com/downloads/moment.min.js')
.then(response => response.text())
.then(text => eval(text))
If the library was not imported in the regular form you can't access it; if you want to use moment() in the Chrome console you can try to open the official site and then go to the console.
In the console you can write something like
moment("20111031", "YYYYMMDD").fromNow();

Error reported while running Laucher by chisel

I downloaded the chisel-tutorial which is offered on the website of usb-bar.
In order to do practise I created a scala file named as "Regfile.scala" under the path:
"chisel-tutorial/src/main/scala/solutions/Regfile.scala".
The Test-file is stored under the path :
"chisel-tutorial/src/test/scala/solutions/RegfileTests.scala".
While running the sbt I was reported
(after execution of command "test:run-main solutions.Launcher Regfile"):
"Errors: 1: in the following tutorials
Bad tutorial name: Regfile "
How can I solve this problem?
You have to add your Regfile to Launcher.scala. The launcher is available in directory :
src/test/scala/solutions/Launcher.scala
I think you can add somethings like this to Launch.scala to test your Regfile:
"Regfile" -> { (backendName: String) =>
Driver(() => new Regfile(), backendName) {
(c) => new RegfileTests(c)
}
},

cannot conenct to report builder 2.0

I work with sql server 2008
When I click the report builder button in report manager.a box shows up "Cannot extract application .Authentification error"
Error details
* [23/04/2012 09:27:59] System.Deployment.Application.DeploymentDownloadException (sous-type inconnu)
- Échec du téléchargement de http://admin-pc/ReportServer/ReportB...er.application.
- Source*: System.Deployment
- Trace de la pile*:
à System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
à System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
à System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
à System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
à System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
à System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
à System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
à System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
--- Exception interne ---
System.Net.WebException
- Le serveur distant a retourné une erreur*: (401) Non autorisé.
- Source*: System
- Trace de la pile*:
à System.Net.HttpWebRequest.GetResponse()
à System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
When I ran the application from the its directory
C:\Program Files\Microsoft SQL Server\MSRS10.MSSQL2008\Reporting Services\ReportServer\ReportBuilder
It works fine but cannot connect to report server
the call is made from the user configured to run SSRS. Does it have permission to do it? If the SSRS server is on you local computer, try setting your user to run it and then test again