System.AccessViolationException with Sqlite.Connection.LoadExtension() - sqlite

I have an old 2005 VB.NET application that requires a Sqlite update for JSON functions.
I have downloaded and installed "sqlite-netFx20-setup-bundle-x86-2005-1.0.109.0.exe". I removed the Reference to the older version, and re-referenced to this new version. I compiled a run the program - all seemed to be okay.
Using an online example for JSON, put the following code behind a TestButton:-
jsondb.SQL = "CREATE TABLE user (name, phone)"
ExecuteSQLiteCommand(jsondb)
jsondb.SQL = "INSERT INTO user (name, phone) values('oz', json('{""""cell"""":""""+491765"""", """"home"""":""""+498973""""}'))"
ExecuteSQLiteCommand(jsondb)
When the "INSERT" is executed, I get "json function not found".
After more research, I found that I had to enable the json extensions with:-
mySQLdb.Connection.Open()
mySQLdb.Connection.EnableExtensions(True)
mySQLdb.Connection.LoadExtension("SQLite.Interop.dll", "sqlite3_json_init")
Initially, the .LoadExtension failed because the "SQLite.Interop.dll" module was not found.
I found a copy of this module in "sqlite-netFx20-binary-Win32-2005-1.0.109.0.zip" and copied it into the Sqlite install directory, and changed the .LoadExension method to:-
mySQLdb.Connection.LoadExtension("C:\Program Files\System.Data.SQLite\2005\bin\SQLite.Interop.dll", "sqlite3_json_init")
Now the .LoadExension method raises an exception "System.AccessViolationException".
Does anyone know how I can resolve this issue?
Thanks in advance.

It seems that because I have the Sqlite Reference attribute CopyLocal=true, then the folder location for System.Data.SQLite.dll and SQLite.Interop.dll need to be the same.
Changing the .LoadExtension to:-
mySQLdb.Connection.LoadExtension(My.Application.Info.DirectoryPath & "\SQLite.Interop.dll", "sqlite3_json_init")
Fixed this.

Related

Failure to write edited values into new IFC file in WIT using ExportFileAsIFC using the same code as in the IFC.js Crash Course

When I attempt to edit an IFCBUILDINGSTOREY name value and write a new IFC file in WIT using the ExportFileAsIFC code from the IFC.js Crash Course IFC editing section, I get an error: Line object cannot be serialized:
Object { expressID: 138, type: 3124254112, GlobalId: {…}, OwnerHistory: {…}, Name: {…}, Description: null, ObjectType: {…}, ObjectPlacement: {…}, Representation: null, LongName: {…}, … } IFCWorker.js:87228:15. The value is definitely changed in the IFC data in the browser console output but it doesn't get written to the new IFC file. I cannot see any difference between my code and the course example code. The problem appears to be that the revised IFC data in the browser console output defines the storey as IFCBUILDINGSTOREY in the IFC.js course video but on my laptop the storey is defined as OBJECT in the browser console output. So I think it literally cannot serialize the non-specific OBJECT.
I have posted the project on my GitHub at https://github.com/quarto-zz/WIT2
Please can anyone tell me what is different?
Looks like a regression in web-ifc#0.0.36. We are looking into it. In the meantime, it should be solved by using the previous version by running the command: npm i web-ifc#0.0.35 web-ifc-three#0.0.118.
Solution found! In discussions with #ansoni on Discord at IFC.js the problem turned out to be two IFC library versions. The Crash Course videos show the library install commands for web-ifc and web-ifc-three as generic, which installs the latest version of each. The current versions of those two libraries cause a couple of issues, including the above problem. At this time, it is important to install the specific versions used in the Crash Course.
npm i web-ifc#0.0.35 web-ifc-three#0.0.118
You can check which versions you have currently loaded in the package.json file.
If you install the correct versions, be sure to replace the wasm and IfcWorker files locally, if you are already using them.
This will solve the above ExportFileAsIFC issue and also a failure to load an IFC file into a WIV scene issue.
The latest versions of these libraries that I had these issues with are:
web-ifc#0.0.36 and web-ifc-three#0.0.121

VS2019 New Project Templates Not Loading in v16.8.1

I recently updated my vs2019 to latest version (16.8.1) but after completed update , I realized on create new project , new project templates has been not loading !
and I get this message :
click to enlarge
I tried repair vs but it did not work :(
Before the update, nothing was wrong !
EDIT : I checked activitylog.xml but It was useless !
EDIT2 : There is activitylog.xml : Download
EDIT 3 : I repaired Visual Studio for the second time, but I still have the same problem!
EDIT 4 : I still can use command line for create project or run or ... . only Visual Studio have problem
the xml shows the cause:
Microsoft.TemplateEngine.Utils.EngineInitializationException: Error parsing the user settings file
---> Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Path '', line 0, position 0.
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.EnsureLoaded()
--- End of inner exception stack trace ---
at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.EnsureLoaded()
at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.get_Components()
at Microsoft.TemplateEngine.IDE.Bootstrapper.Register(Assembly assembly)
at Microsoft.VisualStudio.TemplateEngine.Shared.Host.TemplateEngineBootstrapperFactory.TemplateEngineBoostrapper.Register(Assembly assembly)
at Microsoft.VisualStudio.TemplateEngine.TemplateEngineHostManager.InitializeEngine()
So the settings.json from %HOMEPATH%\.templateengine\vs\ is somehow corrupted.
As you see I have 3 of them for 16.7, 16.8.0 and 16.8.1. So it looks like the file is generated each time after VS update.
You could try to repair it:
dotnet new --debug:reinit
If this doesn't fix it, report it to Microsoft so that it could be fixed.
A new update was released a few hours ago (v16.8.2) and I just updated VS2019 from v16.8.1 to v16.8.2 And all the problems were solved :)
Thanks for guys who answered .

RedundantNameQualifier error when Running Resharper CLI inspect tool

I'm using Resharper inspect CLI tool for static code analysis(JetBrains.ReSharper.CommandLineTools.2018.3.1\InspectCode.exe) on a dotnet core 2.1 console application I've created. Within the solution, there is a separate project which is just a package used in the console app.
Layout is as follows:
When I run the inspectCode.exe as follows:
JetBrains.ReSharper.CommandLineTools.2018.3.1\InspectCode.exe "AI.DL.Backup\AI.DL.Backup.csproj" /o:"CodeInspection_20222.xml" /profile:"AI.DL.Backup.sln.DotSettings"
I get the following issue:
Output xml report has the following:
<IssueType WikiUrl="https://www.jetbrains.com/resharperplatform/help?Keyword=RedundantNameQualifier" Severity="WARNING" Description="Redundant name qualifier" CategoryId="CodeRedundancy" Category="Redundancies in Code" Id="RedundantNameQualifier"/>
<Issue Message="Qualifier is redundant" Line="5" Offset="146-154" File="AI.DL.Backup\src\AI.DL.Backup\Startup.cs" TypeId="RedundantNameQualifier"/>
The problem seems to be that it cannot find the dll project referenced and is throwing code analysis error (code HAS been built already, so bin/obj folders exist with relevant dlls/packages required).
Ling 5 (as specified) is just the using statement for the separate package, which it cannot resolve and is deeming to be redundant.
using AI.DL.DocumentManagement;
using AI.DL.DocumentManagement.Stores;
Going by the generated XML report, I can see that it can't find the namespace within the separate package. Why would this be? Anyone seen this before?
I was able to work around this issue when I repointed the "inspect.exe" to my solution file instead of individual project!

Parse error when on production

I have developed a Symfony2 project (v2.2.2) and it was working all fine locally.
When I deploy it on my server I meet 2 issues:
the folder /bin does not transfer through Filezilla (impossible to start transfer)
i encounter a parse error when trying to access web/app.php/ in debug mode (see below)
First I do not understand why it would work in local but not on production.
I also guessed these errors where linked but I do not know what is /bin used for (contains only 2 files doctrine and doctrine.php) and if I remove it locally it keeps working ...
Parse error is the following :
"FatalErrorException: Parse: syntax error, unexpected '[' in /home/colocall/twinkler/src/Tk/ExpenseBundle/Services/Expenses.php line 21"
Expenses.php line 15->25:
public function getAllExpenses($member, $group)
{
$all_expenses_col = $group->getExpenses();
$all_expenses = array();
foreach($all_expenses_col as $expense){
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
}
return $all_expenses;
}
Maybe linked to : The parse error also happen when i try to update my database through ssh connection.
If someone would know the reason why I can't make it working it would save my day that i have already lost ...
Thank you in advance,
Jules
Your error is produced by using the short array syntax [] in your code.
It is not available in PHP 5.3.10 aka on your production server. The short syntax was introduced in PHP 5.4 which explains why your code is working in your dev-environment.
change ...
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
...to
$all_expenses[] = array($expense, $this->forYou($member, $expense));
... or update your server's php version and it will work :)

Use qjson in my Qt symbain app

I'm using Qt to develop a Symbian app.
I downloaded qjson from the link. I followed the instructions in that link and yes, I have the qjson.sis file. Now I need to use it in my app. When I tried, I got this error.
Launch failed: Command answer [command error], 1 values(s) to request: 'C|101|Processes|start|""|"MyProject.exe"|[""]|[]|true'
{"Code":-46,Format="Failed to create the process (verify that the executable and all required DLLs have been transferred) (permission denied)"}
Error: 'Failed to create the process (verify that the executable and all required DLLs have been transferred) (permission denied)' Code: -46
And when I press the launch icon, it shows, "Unable to execute file for security reasons".
Then I install the qjson.sis in my mobile and then tried to install my app, I got this error.
:-1: error: Installation failed: 'Failed to overwrite file owned by another package: c:\sys\bin\qjson.dll in ' Code: 131073; see http://wiki.forum.nokia.com/index.php/Symbian_OS_Error_Codes for descriptions of the error codes
In my .pro file I have this.
symbian: {
addFiles.sources = qjson.dll
addFiles.path = /sys/bin
DEPLOYMENT += addFiles
}
symbian: {
LIBS += -lqjson
}
Any ideas...?
Ok, I've just resolved a similar issue: it seems that your current build of QJson's library has different UID3 than the previous one that you installed on the phone.
Each .SIS file that is installed on the device has an identifier. The phone OS tracks which file was installed by which packacge, and if some new package wants to overwrite an existing file, the OS checks whether the new package has the same 'identity' than the previous owner of the file to be overwritten.
If the identity does not match, this error pops up.
There are number of reasons why this could have happened. For example, you could have simply changed the UID3 of the QJson before the build. Or, maybe you have forgot to set the library's UID3? Check the "src.pro' in the QJson project and go to the half of the file, you'd see lines:
#TARGET.UID3 =
TARGET.CAPABILITY = ReadDeviceData WriteDeviceData
If there's #, then you have forgot to set it and the build process assumed, well, letssay 'a random value'. So, now, set it to something, ie. TARGET.UID3 = 0xE0123456. Remember to correct that once you are ready to publish the application.
If a package with broken UID3 gets onto your phone and is blocking something - simply: uninstall it. Go to Settings/Installations/Installed, then find "qjson" and uninstall it. Afterwards, next installtion of qjson should succeed with no problems.

Resources