Persistent UI failed to open file - error in xcode osx - macos

How to solve the following error and why i'm getting this.
Persistent UI failed to open file file://localhost/Users/ev_mac13/Library/Containers/com.xxxxx.testData/Data/Library/Saved%20Application%20State/com.xxxxx.testData.savedState/window_5.data: Too many open files (24)
I m using sqlite database in my applicatation. This error appearing inbetween running the application.
EDIT: The data was fetched and used in collection view and array controller. If i got the above error then i cant open sqlite database.
Assertion failure in -[SQLiteDBConnection executeQuery:], /Users/admin/Desktop/march14/feb22/ToolBox/ToolBoX/DBConnection/SQLiteDBConnection.m:186
2014-03-15 10:25:04.339 ToolBoX[2939:303] Error while creating add statement. 'unable to open database file'
EDIT #2:
i just typed lsof in osx terminal, it shows too many sqlite connections and close all connections. Now fixed.

I've run into this with permissions errors in my home folder.
However, if you're using a SQLite wrapper directly, it's possible it's leaking (as in memory leak) database/connection instances and/or not closing them properly when done, which means new connections are opened in addition each time the database is touched. Get familiar with Instruments (the "Leaks" instrument, specifically) if you're not already, then post the results if you're still stuck.

can try in terminal:
xcode-select --rest

Related

Rstudio tries to access parent directories where I don't have access rights and crashes

My Project is in a shared drive //company/me/project/
I have full read/write access to //company/me/
I have 0 access rights in //company/
Once in a while my Rstudio crashes with the following message
Unexpected exception: rstudio_boost:filesystem::status: Access is denied: "//company
After this i can no longer open my project via Rstudio.
The only workaround i have found is to delete .Rproj.user and create a new project in the same folder
Why is Rstudio trying to access //company/? Is there a configuration I can set to prevent this from happening?
Edit: I have noticed that this usually happens when theres a bug in my code or when I try to stop code that is running.
A possible reason can be that Rstudio (along with R), saves your session to a .Rdata (either by default or possibly because you clicked "Yes" when it asked to save the workspace to .Rdata). R does this to track reproducibility of a session i.e. to determine the last state when Rstudio was closed (or crashed in your case).
And now its trying to restore an exception , which cannot be reproduced as it requires opening up the file and running it (and opening it, is what you want in the first place).
Note that as per RStudio Documentation: .Rproj.user also stores project-specific temporary files (e.g. auto-saved source documents, window-state, etc.).
A recommended solution to this is to set option for never saving the session data i.e. every time Rstudio starts , it is starting with a clean slate for your project. If you are concerned about loosing the commands you ran in your last session , set the option of Always Save History (Even when not saving .RData). See the image below to set things as a default (sourced from Hadley's Comment):
The same settings are also present for a Project too:

Debugging on an end-user PC?

A user that works in my company has an Error 13 Type mismatch in the moment that she wants to input some data in a grid.
The thing is that when she has that problem, my application only shows the error screen and nothing more (I mean it doesn't say where the error occurs).
I want to know if there is a way that I can "see" the problem in a debug application because I don't have the source code of my application in this computer and I don't know if the problem is because of a Windows configuration issue or why this error pops up provided that when she uses another terminal, different to the one that she normally uses, she can do her job without problems (they have the same settings in the two pcs).
I have the source code in my terminal but as say above, in my terminal the error doesn't pop up so I need to see it in her terminal.
How can I do this?

PgAdmin4 unable to query or view data

I have a very basic PostgreSql table. Despite the simple table schema, I cannot query it via PgAdmin4.
The View Data option is unresponsive; Query Tool option becomes unresponsive after a few attempts in opening and closing the panel. When the Query Tool is eventually (somehow) launched, a trivial SQL statement like
SELECT * FROM test_table
will spin forever and never display.
The diagram above shows the exact same table, which is okay under PgAdmin3.
The table was created empty. Then added with a row. But it threw errors about not having a Primary Key. Which also threw errors when I tried to set a Primary Key. So I used TeamPostgreSql to set a Primary Key. So all is good under PgAdmin3 now. Hence I'm really curious about what's going on with PgAdmin4?
I'm running pgAdmin4 v3.0 and I've put localhost as host name.
I mean, left panel > servers > create > server and then connection tab > host name
I could not query tables, clicking on view/edit data > all rows had no results (nor error log entries).
After I changed server name from localhost to 127.0.0.1, all worked as expected!
I hope it helps, because I've lost so much time on this and could not find a proper answer.
I find a way to view query result on Data Output window using the "Reset Layout" command from File menu. Save your current work (query) before as it will kind of restart pgAdmin4. Tested with pgAdmin 2.1
1) First delete the log file to get rid of older logs
2) Start pgAdmin4.
3) Try to view data again
Can you check log file for any errors & paste it here?
Linux log location: ~/.pgadmin/pgadmin4.log
Windows log location:
C:\Users\YOUR_USERNAME\AppData\Roaming\pgAdmin\pgadmin4.log
Try naming your columns with lower case letters.
Or try with a blank query and write the SQL commands manually:
SELECT * FROM “test_table”
ORDER BY “Apple” ASC
I think this is a bug. The command the pgAdmin 4 is sending, does not contain the double quotes in the order command on the column name, and if you have upper case letters, SQL is going to convert them to lower case letters, thus not finding the sorting criteria.
I had a similar problem.
For me the Query Tool did render, however I could not see the Query Tool until after I expanded the view.
Then even after expanding I was not able to see the result of the query until I ran ( File -> Reset Layout ) as Guillaume Raymond suggest.
Before Expand
After Expand
After Running Reset Layout
I fixed this by opening the connection, changing just the connection name and saving the connection.
Based on other comments, I'd say there is likely some difference in the persisted format of the connection and they need to be resaved by the new version to work.
Warning: You may need to recreate connections.
This worked for me.
1.) Shutdown pgadmin4 3.1
2.) Delete folder: C:\Users\YOUR_USERNAME\AppData\Roaming\pgAdmin
Faced a similar issue where the problem was caused by Firefox, pgADmin 4. Launching pgAdmin in Chrome solved the issue.
This problem I experienced with the internet explorer browser where the query tool was not loading at all. It just kept on spinning with a circle. I solved this issue by using chrome browser.
When you launch pgadmin4 it launches in internet explorer by deafult. it has a key attached to it like
http://127.0.0.1:57756/?key=0371aabd-b4c7-4454-8234-b1234416d7e5e.
you can just paste the above url in the browser directly and the pgadmin4 will open
and query tool works in it. Or you cna use cmd and paste the belwo command and pgadmin4 will open as a standlone application rather tahn another tab in the browser and you cna use it like old pgadmin3.
C:\windows\system32>"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app=http://127.0.0.1:57756/?key=0371aabd-b4c7-4454-8234-b1234416d7e5e
I had the same problem (version 4.18). Only the following worked for me:
Create a new server group (!) by right-clicking on "servers" in the left-hand navigation.
In this new group I created the desired connection to the database (with host name 127.0.0.1)
After that I could finally work with it
You can remove pgadmin4, then reinstall it. It worked for me. I used Ubuntu 18.04.
Here is my command on terminal:
sudo apt autoremove pgadmin4
sudo apt install pgadmin4 pgadmin4-apache2 -y

Magento FPC throwing "failed to open stream: No such file or directory"

Our Magento started throwing this error for Full Page Cache entries two days ago, and is constantly flooding the log. No errors on front though but it seems , judging by the speed, that it's not cached. So log is full of this:
DEBUG (7): file_get_contents(/...var/full_page_cache//mage--tags/mage---713_CATALOG_PRODUCT_67229): failed to open stream: No such file or directory ...lib/Mage/Cache/Backend/File.php
Installed new magento in a subdir, all works fine. reverted code to three months ago, same error.
disabled all custom modules, no effect.
permissions seem alright, cause magento can write to all folders.
one peculiar behaviour we noticed is that a file gets created in var/full_page_cache and then immidiately disappears.. only mage--tags stays populated.. we had redis installed and handling FPC, errors started showing up after we disabled it (and Magento fell back to its own FPC)
Any ideas?
UPDATE: The errors get spawned while Navision sync (Using magento api) is working.
Check your cache path from error log:
file_get_contents(/...var/full_page_cache//mage--tags/mage---713_CATALOG_PRODUCT_67229): failed to open stream: No such file or directory ...lib/Mage/Cache/Backend/File.php
Path is incorrect in '...full_page_cache//mage--tags...' part. Change // to / and issue gone.

Why does building in Xcode overwrite my SQLite database?

First of all, I'm not using Core Data, I'm using SQLite only.
I save the data in the table and then query them by opening the app and looking at the data using SQLiteStudio. I even create a LOG to check that the data is saved, and yes, it is saved.
But when I STOP and run the simulator again to consult, there is no more data!
Is Xcode overwriting the database every time? Or is something else happening that is outside my limited knowledge?
Without knowing more about how your application is setup, how you've got your app configured to build, or how it operates on the SQLite DB file in question I'll only be able to offer some pointers in things you can go check out about your code and build configuration that may be the source of your phantom deletions. Of course, if you have other info to provide, I'd be happy to edit my answer!
Case 1: 'Create DB' always running?
One thing that may be tripping your app up is what happens leading up to the decision to create a new SQLite DB file or look/open an existing file. If the code creating an empty DB is always running, then each time your app starts, your old DB file is getting overwritten with a blank DB.
Case 2: Using a 'starter' or 'template' empty database?
Sometimes developers may provide a blank database that contains the initial database schema (the general tables and structure) as well as some default or sample data. If your app does this, perhaps the logic leading up to the decision to apply that default database is accidentally always being triggered? If so, use of NSUserDefaults to record a boolean indicating the DB was successfully created may be an avenue to use to skip past the 'Load my starter DB' code. Alternatively, you could check for the existence of your DB file, or see if the contents of a specific table are different from the template data, etc.
Case 3: Different Behavior between 'Build & Run' vs. 'Run Without Building'
There's a not-so-well-known option in the Product > Perform Action menu labelled 'Run without Building' that will essentially kickoff another Debug session using the version of the application you just finished running in the Simulator or on Device. When you use this option do you see any different behavior with your database or is it still blank?
Case 4: Different Behavior when run directly in Simulator outside of an Xcode debugging session?
Part of the 'Run' operation is a build phase which may trigger the 'Copy Resources' phase even if your app hasn't changed since the last execution (as you suggest is the case in your question). If you are providing a stock 'default' or 'template' DB file and your app is simply opening and editing that 'template' during the first execution of your app, then Xcode may be replacing it with a clean copy on the subsequent 'Run' operations where 'Copy Resources' is happening. A way to test this avenue:
Build and Run your app to the simulator using Xcode like normal.
Perform some operations that would result in the creation or editing of data in your app's database.
Click the stop button in Xcode to return to the Simulator home screen.
Double-click the home button on the simulator (or if there is no home button, press CMD+SHIFT+H twice to bring up the multitasking bar and force-quit out of your application.
Check and see if your DB file has data in it.
If no data, then there is an issue persisting your changes into the database and we need to get that problem solved first. Otherwise:
Relaunch your app directly from iOS Simulator and perform different operations that would result in more or different changes to the database.
Click on the home button to return to the iOS Home Screen.
Force-quit your appellation as was done in Step 4.
Check and see if your DB file data has changed (but still has data) or has blanked out.
Finally, make sure you are following Apple's guidance about where to store user-data, if you are inadvertently storing something in an incorrect file path doesn't typically result in blanking of data, it may be prohibiting writing of data which could be interpreted as your data getting overwritten especially if you are interrogating it while it still is residing in an in-memory process. There's some really useful guidance about file paths in the Table 1-1: (http://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html)
Locating your Simulator App on your Mac's Hard Drive
To be thorough (and you may already know about this!), iOS Simulator applications are stored on your Mac's hard drive just like other files on your machine. Their organization mimics that of a physical iOS device. To get to your App and its data:
Open a new Finder window.
Press CMD+SHIFT+G or choose 'Go to Folder' from the 'Go' menu.
Paste the following into the 'Go to Folder' box then click 'Go': ~/Library/Application Support/iPhone Simulator/
Select the folder that matches the iOS version of the simulator you built to.
Click on Appications.
You'll then be presented with zero or more folders, each folder that appears will have a string of digits separated by hyphens. Navigate through this list until you find the one containing your app. You can then browse, and copy data out of this folder to somewhere to be examined by other tools on your Mac.

Resources