Amazon Launch Template - Updated AMI - amazon-ec2

I have started using Amazon's new Launch Templates and so far liking it however I just recently made an image from one of my instances, I then created a new version of the Launch template and used the new AMI.
When updating my auto scaling group to the new version of the template, upon save it gives me the below error:
Error
You must use a valid fully-formed launch template. snapshotId cannot be modified on root device
Do I need to recreate the AMI?

Ok after a few tries I've discovered that the hint is in the error message as unclear as it was at the time.
What I didn't do when creating the new version of the Launch Template was, after updating the AMI ID, I also needed to update the Snapshot ID of the volume used by the template, to the Snapshot ID of the snapshot created when the AMI was created.
Would help if when changing the AMI, it searched a list of existing AMIs then allowed you to select the one you want which will then update the template with the necessary things such as Snapshot ID...
c'est la vie

UPDATE: Today (2019-11-21) AWS released a new Launch Configuration web gui which no longer appears to have this problem - updating the AMI seems to clear out the explicit EBS association no matter what.
Original answer:
This is actually a small specific bug in the AWS web console's interface for creating a new launch template version.
When you enter a new AMI ID in your new launch template version, it shows the new AMI on screen, but it shows the previous block device (snapshot) still. If the very next button you press is 'Create launch template', then you unfortunately get a launch template which point to the new AMI but still points to the old EBS snapshot. If instead the next thing you do is scroll down to the 'Storage (Volumes)' list, and click anywhere in the page, you'll see the listed snapshot update before your eyes, from the old one to the new one. Now when you click 'Create launch template' it will create with the correct snapshot attached.

Allow me to described what worked for me. The issue was that AMI was created out of 15 GB volume, however, LC would create a new machine with volume size 8 GB and fit 15 GB inside. I just created new LC and increased the volume size.

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:

reason = "The model used to open the store is incompatible with the one used to create the store"

i am creating os x app with core data. when i am modify the model. the error occurred that is showed in the image. the reason shown is "The model used to open the store is incompatible with the one used to create the store"; how to fix this error. this same error i fixed by clearing the simulator in iOS app . how to fix this in os x app.
enter image description here
If you look at the code that sets up your persistentStoreCoordinator, it should tell you where the storage for your objects is located and the file name. (The default location from the Apple template is provided by the applicationDocumentsDirectory method inside the app delegate.)
The usual location for the data store of a non-document-based Core Data application is in ~/Library/Application/Support/com.mydomain.myapp/CocoaAppCD.storedata.
Rename or delete this file (depending on whether its contents are disposable).
Re-launching your application will recreate the file with no data and you can start re-populating it according to your new model.
With production versions of your application, a model change would require a formal lightweight or heavy migration to preserve the user's data.
As a convenience, on startup I print out the location of the database to the console as follows:
// Get / print location of database for use in testing / debugging
let paths = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)
let path = paths[0] + "/LocalStore.sqlite"
print(path.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines))
Besides being easy to see, I can just select/copy/past this to use in sqliteBrowser.
Choose Finder and go to Library from Go by clicking option button on keyboard. then search on library using your app Bundle Identifier. delete the folder with it. then Re-launching your application will recreate the folder with no data and you can start re-populating it according to your new model.

How to add App Groups iOS 8 Extension?

I am having a strange issue: In the project i am working we have to introduce Share extension. The problem i have now is that the app Groups cannot be added.
When i activate it it shows that i have an issue at https://www.dropbox.com/s/sp7tqbv9x6q175i/Screenshot%202015-01-07%2009.56.34.png?dl=0 . If i use a different bundle id for the main app target it works but i must use this bundle id.
And if i try to add app groups https://www.dropbox.com/s/7pi1n4j8xajngvm/Screenshot%202015-01-07%2010.03.44.png?dl=0 the same error appears but one row up. I tried to change this settings from the provision portal from app IDs, there works and adds it without a problem.
Thank you.
Ok so i fixed this issue by going to Provision portal,identifiers->App IDs, your id, edit, app groups enable, edit set app group and save. Now go to provision profile and re-generate all the inactive Provision profiles and download them. After that it worked.
Your App Group ID must be in this format:
group.#yourcustombundleid#
Like this:
Good luck!

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.

Problem in working with core data

Am using core data framework in my cocoa application,I have created couple of entities and created reference using NSEntityDescription. When i run the application am getting an error saying that "The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store."
You need to delete the application from your device / simulator, then build and run again.
This will happen each time you change your model, because the old data store will remain in the apps documents folder, while the classes accessing it have been altered.
In a later stage of development, you will propably want to introduce store migration, sou your testers and users won't have to delete their data each time a new version is released. If your model remains static though, you don't need to migrate the data during future updates.
You might want to take a look at the Core Data Migration Programming Guide for further information.
The answer is a bit tricky but this always works for me. This is for a clean installation of a new compatible .sqlite file, not a migration!
launch simulator, delete the app and the data (the popup after you delete the app).
quit simulator
open X-Code, after making any edits to your data model
delete the {*appname*}.sqlite file (or back it up, remove it from project folder, and delete reference)
clean the app (Product > Clean)
Run the app in a simulator (for this tutorial I will assume 4.2)
While the simulator is running, in a Finder window, navigate to:
{*home*} > Library > Application Support > iPhone Simulator > 4.2 > Applications > {*random identifier*} > Documents > {*appname*}.sqlite
Copy this file to another location
Stop running your app in X-Code
Drag and drop the {appname}.sqlite file into the files list in X-Code.
In the dialog that pops up, make sure the copy to folder checkbox, is checked.
Product > Clean
Then run the app in the simulator again
Now you should have a working sqlite file!
Cheers,
Robert
You must delete the persistent store file from either:
~/Library/$AppName
~/Library/Application Support/$AppName
(Depending on your version of Xcode.)

Resources