In the process of C++ project, a function of opening and saving files needs to be implemented. After I write to the file tmp.dat, I want to write to the file for the second time. At this time, an error returning int error = 13 (Permission denied) occurs in both fopen_s and _wfopen_s.
Since the project is Unicode encoded, there is no way to use Fopen for file operations (fopen is available and Shared reads and writes are available as long as _CRT_SECURE_NO_WARNINGS is added to the precompile, which I don’t want to do). So all kinds of search, and look up MSDN. Here’s what it says on MSDN:
Files opened by fopen_s and _wfopen_s are not sharable. If you require that a file be sharable, use _fsopen, _wfsopen with the appropriate sharing mode constant (for example, _SH_DENYNO for read/write sharing).
Link: https://msdn.microsoft.com/zh-cn/library/z5hh6ee9 (v = versus 90). Aspx
That is, fopen_s and _Wfopen_s do not support file sharing. When you use fopen_s or _wfopen_s for read or write operations, you can only do one operation (i.e., you can only do one read or write operation). Note: If you use fopen_s or _wfopen_s once for a file in a different place, the file becomes unshared. If you read or write a file again, you may return an int error = 13 (EACCES (Permission denied). I just changed one place in the project, but it still doesn’t work the second time. I need to change all the places that involve reading and writing to _fsopen, _wfsopen.
FILE * FP = _wfsopen(tmpFile, _T(” WB “), _SH_DENYNO);
Error: Uncaught (in promise): Error: StaticInjectorError[NavController]
By default you can’t use navController or viewController or anything like that in a Controller or a service.
Code:
An easier solution,
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { NavController, AlertController, App } from 'ionic-angular';
import {LoginPage} from "../pages/login/login";
@Injectable()
export class CommonProvider {
public session:any;
constructor(
public http: HttpClient,
public alertCtrl: AlertController,
public appCtrl : App
) {}
public getSession() {
let activeNav: NavController = this.appCtrl.getActiveNav();
this.session = window.localStorage.getItem('session');
if(!this.session) {
activeNav.setRoot(LoginPage);
return false;
}
return this.session;
}
Jython installation is a bit bumpy
Jython installation small bumpy background software configuration installation process encountered problems in the last episode
Jython installation is a bit bumpy
background
Since Jython is required to use MonkeyRunner, let’s take a look at the bumps in the Android process.
Software configuration
Operating system: Windows 7 64-bit Java version: 1.8.3 Python version: 2.7.8
The installation process
To get started, go to Jython’s official website and download the latest version of Jython, which comes in a.JAR. in CMD directly with java-jar + jar command to install
Problems encountered
After using the latest version of Jython installation, an Error was reported in CMD, indicating Error loading python27.dll (Error code 14001). The search engine searched and found the reason on stackoverflow. Jython2.7.1 does not support Windows 7. You can only download version 2.7.0 or lower. You found 2.7.0 here and downloaded the JAR package. is installed directly in CMD with the java-jar + jar command, as before. error was reported again this time. The error was reported as follows:
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
This does not need the search engine to know is Java is too high, alas, have no way, have to change the environment variable of the system Java in the computer to 1.7. thought this would be fine, did not expect, after changing the Java version to reinstall the same prompt, I wonder. I read the Java version in CMD with java-version, 1.7. Why not?Have no way, have to turn to search engine again. [results] (https://stackoverflow.com/questions/29697543/registry-key-error-java-version-has-value-1-8-but-1-7-is-required) found the answer in this: the reason is that in the system path, Windows\System32 or Windows\SysWOW64 there are java.exe, javaw.exe, javaws.exe0 these files are still 1.8.3. in this case, I guess the cache, although the environment variable has changed, but the path has not been changed.
The last
Finally, it is installed successfully. To check whether it is installed, you need to configure the environment variable. jython.exe· the path is in the /bin file of the installation path. After configuring it, just like Python, enter jython ‘in CMD directly and see if it enters jython.
episode
When the installation failed at the beginning, I went to the official installation guide on the official website. Jar –help java-jar jythn-installer -2.7.1.jar –help I found that -help or -help is very useful, sometimes do not know what command, you can type this parameter in the back, see if it is useful. “Hee hee”
usage:
java -jar jython-installer-2.7.0.jar [-c | -s | -A] [-d dir] [-t type] [-i
part(s)] [-e part(s)] [-v] [-h | -?]
No option at all will start the interactive GUI installer, except:
Options respected in GUI mode are 'directory', which serve as default values
in the wizard.
In non-GUI mode the following options are available:
-c,--console console based installation (user interaction)
any other options will be ignored (except 'verbose')
-s,--silent silent installation (without user interaction)
-A,--autotest automatic stress tests for the installer
most of the other options are ignored
allowed additional options: 'verbose
-d,--directory <dir> target directory to install to
(required in silent mode,
used as default in GUI mode)
-t,--type <type> installation type
one of the following types is possible
(see also include/exclude parts):
- all: everything (including src)
- standard: core, mod, demo, doc, ensurepip
standard is the default
- minimum: core
- standalone: install a single, executable .jar,
containing all the modules
-i,--include <part(s)> finer control over parts to install
more than one of the following is possible:
- mod: library modules
- demo: demos and examples
- doc: documentation
- src: java source code
- ensurepip: install pip and setuptools
-e,--exclude <part(s)> finer control over parts not to install
more than one of the following is possible:
- mod: library modules
- demo: demos and examples
- doc: documentation
- src: java source code
- ensurepip: install pip and setuptools
(excludes override includes)
-v,--verbose print more output during the installation
(also valid in GUI and autotest mode)
-h,--help print this help (overrides any other options)
-? print this help (overrides any other options)
example of a GUI installation:
java -jar jython-installer-2.7.0.jar
example of a console installation:
java -jar jython-installer-2.7.0.jar -c
example of a silent installation:
java -jar jython-installer-2.7.0.jar -s -d targetDirectory
examples of a silent installation with more options:
java -jar jython-installer-2.7.0.jar -s -d targetDirectory -t minimum -i src
java -jar jython-installer-2.7.0.jar -s -d targetDirectory -t standard -e demo doc -i src
example of an autotest installation into temporary directories:
java -jar jython-installer-2.7.0.jar -A
(uses java.awt.Robot; make sure you do NOT touch mouse NOR keyboard
after hitting enter/return!)
In the end, I deliberately installed it without a graphical interface, using -C to install it with the console, and found that there were more options to choose than the graphical interface, so I won’t expand it here. be interested in yourself to try.
The Error converting Data type Varchar to Datetime is probably the most common Error of the SQLServer. The Error converting data type Varchar is usually due to the inputting of the date string VarchAR and the default date format in the SQL database, Default_DateFormat, which is commonly found in non-Chinese SQL server. Because SQLServer is available in different languages, the default date format is also “dmy “, “mdy”, “ymd”. Here D is the date, M is the month, and y is the year, but in different order. An error occurs if the date string entered is not in the same order as the default date format of the database system. You can see what language is in what format; you can use the statement from EXEC SP_HELPLANGUAGE.
After checking online, the default language of the database can be set to Chinese to solve the problem, but this only solves the string problem of Insert data, not the problem of using date parameters directly in the StoredProcedure storage method. And for the Chinese date input problem, it is necessary to set the entire database code into Chinese, is not a good solution. And it seems that the date pattern invoked in the StoredProcedure does not depend on the default language of the system, but rather on the version language of the database. Fortunately, SQLServer also provides a method to set the default language of Login Login name, so that we can take the Login account to set the default language of Chinese Login, so as to solve the format conversion error idea.
USE MASTER
EXEC SP_DEFAULTLANGUAGE ‘login name ‘, ‘Simplified Chinese’
This method is tested.
Look at the SQLServer tutorial, it seems that the SQLServer 2005 version of the above, can also be used directly
ALTER LOGIN LOGIN name WITH DEFAULT_LANGUAGE = ‘Simplified Chinese’
But this statement did not compile on my SQL EXPRESS 2008.
In this way, after the user USES the set account to log in, the system default language is the set language, the date format conversion error problem is solved.
./configure –prefix=/usr/local/nginx –with-http_ssl_module –with-http_stub_status_module –add-module=/usr/local/ngx_devel_kit-0.3.0 –add-module=/usr/local/ lua-nginx-Module-0.10.6 – add – the module =/usr/local/echo – nginx – module – 0.60 – with – cc – opt = “-i/usr/local/Cellar/pcre/8.39/include” – with – ld – opt = “-l/usr/local/lib/Cellar/pcre/8.39”
The e problem that had puzzled us for two days was finally solved.
Increase these two parameters
– with – cc – opt = “-i/usr/local/Cellar/pcre/8.39/include” – with – ld – opt = “-l/usr/local/lib/Cellar/pcre/8.39”
Today, I updated my Flash Player plugin to version 10.0.42.34. Then it turns out that a DVF that was previously running locally is running today and throwing an exception. The prompt message is as follows:
SecurityError: Error # 2060: security sandbox conflict: the ExternalInterface caller file://D:/study/flex/service/bin/rainbowX.swf file://D:/study/flex/service/bin/rainbowX_Debug.html can be accessed. at flash.external::ExternalInterface$/_initJS() at flash.external::ExternalInterface$/addCallback() at freeidea.rainbowX::Application()
According to the prompt of debugging information because calls the ExternalInterface. AddCallback method. I take a look at the help documentation, which describes how this method throws a security exception as follows:
trigger
Error — this container does not support incoming calls. Incoming calls are supported only in Internet Explorer for Windows and browsers that use the NPRuntime API, such as Mozilla 1.7.5 and later or Firefox 1.0 and later.
0 SecurityError 1 — ActionScript in the sandbox where you have no access has added a callback with the specified name; You cannot override the callback. To solve this problem, rewrite the ActionScript that originally called the addCallback() so that it also calls the security.allowdomain () . td> tr>
td> tr>
td>
SecurityError code> - contains the environment belongs to the calling code has no right to access security sandbox. To solve this problem, follow these steps:
in the HTML page containing the SWF file, set the following parameters in the object tag of the file: < param name="" value="always" /> code> in the SWF file, add the following ActionScript: flash. System. Security. AllowDomain (sourceDomain) code> ol> td> tr> tbody> table>
Looking at the help instructions above, I think it may be due to cross-domain access issues, as mentioned in the article author (Developer) Control that if SWF wants to communicate with HTML scripts, then the value of allowScriptAccess for the plug-in must be set to Always. And SWF to allow access to the domain. So I try to join in the SWF flash system. Security. AllowDomain (" * "); Then add < < < param name="allowScriptAccess" value="always" /> This sentence. but the problem is still unresolved. There's no other way to think about it. Later, I found that my DVF could be browsed in the output folder of Project (I built it with Flex), but once I moved to another directory, it was not ok. As a result, I looked up the data and saw the following article, which was called "Overview of Permission Control". This article mainly shows what the Flash Player security model looks like. Below I put up part of the content, interested friends can go to the Internet search. overview of permission control Flash Player client runtime security model is a model designed around object resources such as SWF files, local data, and Internet urls. "Resource holders" means the parties that own or use these resources. Resource holders have control over their own resources (security Settings), and each resource has four holders. Flash Player USES a strict hierarchy of rights for these controls, as shown in the figure below:
security control hierarchy
the figure shows that if an administrator restricts access to a resource, no other holder can override the restriction. administrative user control
The administrative user of the computer (the user logging in with administrative privileges) can apply Flash Player security Settings that affect all users of the computer. In a non-enterprise environment, such as a home computer, there is usually only one user, who also has administrative access. Even in an enterprise environment, a single user can have computer administration rights.
There are two types of administrative user control: MMS. CFG file "global Flash Player trust" directory MMS. CFG file on Mac OS X, the MMS. CFG file is located in /Library/Application Support/Macromedia. On Microsoft Windows system, the file is located in the system directory of the Macromedia Flash Player folder (for example, in the default install Windows XP to C:/Windows/system32/macromed/Flash/MMS CFG). Flash Player will read its security Settings from this file when it starts, and then use these Settings to restrict the functionality.
The MMS. CFG file includes Settings that the administrator USES to perform the following tasks: data loading - restricts reading of local SWF files, prohibits file downloading and uploading, and sets storage limits on permanent Shared objects. privacy controls - disable microphone and camera access, prohibit SWF files from playing windowless content, and prohibit SWF files from accessing permanently Shared objects in domains that do not match the URL displayed in the browser window. Flash Player updates - sets the time interval to check Flash Player updates, specifies the URL to use to check Flash Player updates, specifies the URL from which to download Flash Player updates, and completely disables automatic Flash Player updates. older file support - specifies whether earlier versions of SWF files should be placed in a trusted local sandbox. local file security - specifies whether a local file can be placed in a trusted local sandbox. full screen mode - disable full screen mode. SWF file can be by calling the "Capabilities. AvHardwareDisable code> and " Capabilities. LocalFileReadDisable code> property to access functionality disabled some of the information. However, most of the Settings in the MMS.cfg file cannot be queried through ActionScript. is to enforce application-independent security and privacy policies on the computer, and only the mms.cfg file can be modified by the system administrator. The MMS. CFG file cannot be used to install the application. While an installer running with administrative permissions can modify the contents of the MS.cfg file, Adobe considers such use a violation of the user's trust and advises the creator of the installer never to modify the MS.cfg file. global Flash Player trust directory
The administrative user and installation application can register the specified local SWF file as trusted. These SWF files are assigned to trusted local sandboxes. They can interact with any other SWF file or load data from anywhere (remote or local). The file is specified as trusted in the global Flash Player trust directory, the same directory as the mms.cfg file, in the location (specific to the current user) as follows:
The Windows: the system/Macromed/Flash/FlashPlayerTrust code> (for example, C:/Windows/system32/Macromed/Flash/FlashPlayerTrust) code> Mac: App support/Macromedia FlashPlayerTrust code> (for example,/Library/Application support/Macromedia/FlashPlayerTrust) code>
The Flash Player trust directory can contain any number of text files, with each file listing the trusted path on one line. Each path can be a single SWF file, HTML file, or directory. Comment lines start with #. For example, a Flash Player trust profile with the following text indicates that trusted status is granted to all files in the specified directory and all subdirectories:
# Trust files in the following directories:
C:/Documents and Settings/All Users/Documents/SampleApp
The path listed in the trust profile should always be the local path or the SMB network path. Any HTTP path in the trust profile will be ignored; Only local files can be trusted. to avoid conflicts, specify a filename for each trust profile that corresponds to the installed application, and use the.cfg file extension. because developers distribute locally running SWF files by installing the application, you can have the installation application add a configuration file to the global Flash Player trust directory, granting full access to the files to be distributed. The installation application must be run by a user with administrative rights. Unlike the MMS.cfg file, the global Flash Player Trust directory is included to enable the installation application to grant trust permissions. Both managing users and installing applications can specify trusted local applications using the Global Flash Player Trust directory. after reading this article, it turns out that the project in Flex actually adds the output file from the project to the local trust sandbox. The CFG documentation for Flex was also found in the local directory specified, which does include the output folders for each project. So I also tried to add the directory where the DVF was in to the local trust sandbox. The entire folder path string is written to a text file based on the CFG file format described in the article, and then saved as a CFG file. Put it in the system/Macromed/Flash/FlashPlayerTrust. Then run the DVF again, the error message is gone, and the problem is resolved. in retrospect, Flash Player is really getting stricter with security. The current version is so strict even for local runs (the version I used before was 9.0, so long as You set allowScriptAccess to always in HTML). Only a thorough understanding of Flash Player's security mechanisms can help us solve the problem better. However, I use above is the management of user control method to achieve, so it is the highest level of configuration, there may be relatively large security risks, you can also try to use the ordinary user control method to add trust. The article write here, hope to be helpful to everybody.
When Jenkins was used, all of a sudden the jobs could not be executed, and the configuration page prompted an error, as follows:
After Baidu, many solutions were only for the type “returned Status code 128”, with the detailed error of SSH-key, git server could not request to wait, and no error about “Text File busy” was found.
Finally, I found the answer to Jenkins’ official Github question,
https://github.com/joelittlejohn/embedmongo-maven-plugin/issues/28
The simple answer is that Jenkins was on a server that ran out of disk space.
You can use the Library (JSONLite) package
jsonmessage< -read_json(name.json,simplifyVector = FALSE)
jsonmessage$Month$minute[[1]]$number\
You can use layers of lists to find the information you want
But jsonLite will report an error when reading a Chinese-named JSON file
Error in parse_con(TXT, bigint_as_char) : circum-error: invalid char in json text.
Now I can change it to Library (RJSONIO)
ts1< -RJSONIO::fromJSON(name.json)
If something is character and you can’t select one of them, just make it a list
ts1$month$minute[[1]]
Name, age, gender, job
Lili 20 female enginner
This string has a noun corresponding to it
To the list
ts1$month$minute[[1]]< -as.list(ts1$month$minute[[1]])
You can turn it into a list and continue to select the items you want
When the Connection is created in the database Connection pool and long time not to use cases, the Connection will automatically recycling and failure, but the client does not know, still use for database operations is an invalid database Connection, in this way, will lead to the client program to “Java. SQL. SQLException: Io exception: Connection reset” or “Java. SQL. SQLException closed Connection”.
Add after configuring the data source
< property name=”validationQuery” value=”select * from dual”/>
After the configuration, the client tests an invalid connection before using it, and if it finds that the connection is invalid, it retrieves a valid database connection from the connection pool for use.
When setting the data source in Tomcat’s context.xml, please refer to:
& lt; Resource auth=”Container” driverClassName=” OracleDriver” type=”javax.sql.DataSource” url=” JDBC :oracle:thin:@11.11.11.45:1521:orcl” name=” JDBC /login” The username = “login” the password = “login” maxActive = “15” maxIdle = “10” maxWait = “1” minIdle = “2”, “ removeAbandonedTimeout =” 5 “ testOnBorrow =” true “ TestWhileIdle =”true” testOnReturn=” br> “ removeAbandoned=”true” logAbandoned=”true” validationQuery=”select 1 from dual” />
————————————————————-
The above is an article from the Internet. There are several possible reasons for Connection Reset:
1. The number of connections in the configured data connection pool is insufficient;
2. The connection in the database connection pool is not used for a long time, the database actively disconnects, and the client does not know that it still gets an invalid connection when it is in use;
Corresponding to the causes of the above two conjectures, the following are processed:
1. Configure the maximum, minimum and free connections of the connection pool, etc.;
2. Configure the connection in the connection pool to check the validity of the connection, for example, configure the validity of the connection to check the SQL statement, whether the configuration to check the validity of the connection;
The above is just an idea. The specific configuration content should be configured according to different data sources, and the solution can be referred to above. As for whether there are other reasons, it is unknown for now.
In my project, I used c3P0 data source. At that time, I added configuration related to validity check according to the configuration mode of C3P0. For detailed configuration of C3P0, please refer to:
http://blog.csdn.net/majian_1987/article/details/18598857
Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named ‘encodings’
Problem description: when installing anaconda3 process nearing completion pop-up error Python interface, close not to finish after debugging, but at the end of the command line call Python times the above error, the solution is to find on your computer do you have any other versions of Python, if you have just uninstall deleted, or not to delete, but want to go to their corresponding environment path environment variable to delete, keep the latest installation.
This error occurs when you run Anaconda and install SkLearn:
Windows 10 Python 3.6.0 Anaconda
The errors are as follows:
Exception:
Traceback (most recent call last):
File "d:\anaconda3\lib\site-packages\pip\basecommand.py", line 209, in main
status = self.run(options, args)
File "d:\anaconda3\lib\site-packages\pip\commands\install.py", line 317, in run
prefix=options.prefix_path,
File "d:\anaconda3\lib\site-packages\pip\req\req_set.py", line 732, in install
**kwargs
File "d:\anaconda3\lib\site-packages\pip\req\req_install.py", line 835, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "d:\anaconda3\lib\site-packages\pip\req\req_install.py", line 1030, in move_wheel_files
isolated=self.isolated,
File "d:\anaconda3\lib\site-packages\pip\wheel.py", line 344, in move_wheel_files
clobber(source, lib_dir, True)
File "d:\anaconda3\lib\site-packages\pip\wheel.py", line 322, in clobber
shutil.copyfile(srcfile, destfile)
File "d:\anaconda3\lib\shutil.py", line 115, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'd:\\anaconda3\\Lib\\site-packages\\sklearn\\utils\\m
urmurhash.cp35-win_amd64.pyd'
Solution: Run as an administrator: Anaconda Prompt
A new problem arose after the problem was resolved, and when I tried to create a new Python,
Conda create –name py36 python=3.6
Error started again:
CondaHTTPError: HTTP None Nonefor url <None>
An HTTP error occurred when trying to retrieve this URL.
ConnectionError(MaxRetryError('HTTPSConnectionPool(host=\'repo.continuum.io\', p
ort=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Ca
used by ReadTimeoutError("HTTPSConnectionPool(host=\'repo.continuum.io\', port=4
43): Read timed out. (read timeout=6.1)",))',),)
The cause of the error may be a problem with the domestic network connecting to foreign libraries, which may occur with the emergence of some major events.
The change method is to use the image of Tsinghua University as the default library to update, and write the following code under Prompt:
background
Because the code changes, party a is to test their code, let me here to deploy a test environment, good let them to test, I for convenience, copy a copy of the code on the server will be directly from the production, all configuration is changed to test the configuration, on the test server.
Error showing results as soon as soapUi tool was tested, an error was reported. Error Loading WSDL
Analysis:
network problems? but I use Telnet 192.168.4.9:8080 port is through, indicating that there is no problem with the network.
security configuration problem?Since the code is copied from the server, there is no reason why it cannot be run. The only difference is between the test server and the production server. What security configuration has the test server done?Asked colleagues, it seems that there is no special configuration, so I could not access, baidu online, to see if there is the same problem, sure enough, but they changed a tomcat Web.xml auth attribute to false, it can be passed. But I am jboss, how can I find this configuration
tool problem?Starts loading the WSDL file on the production server and shows that it loads normally. Obviously not?
local debug? local deployment setup, local is normal, that is the program itself is no problem.
finally I couldn’t figure it out. I went to the server log and found that there was an error in the server log, that is to say, the project I deployed did not start successfully. Reported a mistake like this. [D:\ jboss-4.2.3.ga \server\default.\deploy\lbsp_service.war] -choose unique values for the ‘webAppRootKey’ content-param in your web.xml files!
final reason: the test server has many projects, when deploying many projects, the project has a content web.xml needs to add this item:
With this addition, the project is normally deployed. The interface has been successfully accessed. Or carefully check the jboss log folder of the log, some errors, just a flash, you do not know whether there is an error. Also, some errors are likely to appear in the log file and not printed in the console, which can mislead you about errors.