save

Simple read/write record .dat file in Delphi

空扰寡人 提交于 2019-11-30 19:23:13
For some reason my OpenID account no longer exists even when I used it yesterday. But anyway. I need to save record data into a .dat file. I tried a lot of searching, but it was all related to databases and BLOB things. I wasn't able to construct anything from it. I have the following record type Scores = record name: string[50]; score: integer; end; var rank: array[1..3] of scores; I just need a simple way of saving and reading the record data from a .dat file. I had the book on how to do it, but that's at school. You should also take a look at the file of -method. This is kinda out-dated,

Android Persist Data After Uninstall

徘徊边缘 提交于 2019-11-30 19:16:52
I have to persist 2 strings for my application even after the application is uninstalled. Regarding that the end users don't have SD cards for their devices and they don't have internet connection, how could I persist those 2 strings even after the app is uninstalled? I would highly appreciate any response. Thanks Unless you're targeting VERY old phones, you don't need to worry about not having external storage. As long as you use Environment.getExternalStorageDirectory() as your reference, you shouldn't have a problem, though if you're absolutely concerned about this you can check if the

scale image to smaller size in swift3 [closed]

我只是一个虾纸丫 提交于 2019-11-30 19:05:42
I am trying to scale a image that is being graphic programmed into the photo gallery. I am trying to scale the image to make it smaller. How would I use the code below to make the image smaller image1.scale fja Use this extension to resize your image: extension UIImage{ func resizeImageWith(newSize: CGSize) -> UIImage { let horizontalRatio = newSize.width / size.width let verticalRatio = newSize.height / size.height let ratio = max(horizontalRatio, verticalRatio) let newSize = CGSize(width: size.width * ratio, height: size.height * ratio) UIGraphicsBeginImageContextWithOptions(newSize, true, 0

How to save many has_many_through objects at the same time in Rails?

假如想象 提交于 2019-11-30 18:57:45
问题 I have two models related as follows. USERS has_many :celebrations has_many :boards, :through => :celebrations BOARDS has_many :celebrations has_many :users, :through => :celebrations CELEBRATIONS :belongs_to :user :belongs_to :board In my controller I want to create the objects from form data. I do this as follows: @user = User.new(params[:user]) @board = Board.new(params[:board]) if @user.save & @board.save @user.celebrations.create(:board_id => @board,:role => "MANAGER") redirect_to

Magento custom model won't allow DB table changes

故事扮演 提交于 2019-11-30 18:42:06
I've run into an issue with a custom Magento module I've created. In short, I created a simple module for customer uploads on the front-end. I created a new table with some generic fields like 'project_id', 'title', etc. This is all fine...I can set model variables and save them to my table using model->save();. Just now I have the need to add a new field or change an old field's name around. For a reason that I can't understand new fields and changed fields will not get stored to via model->save(); even though I can see from my debugger that new and changed variables in my model are being set

Android: Image save to location

烈酒焚心 提交于 2019-11-30 18:30:39
问题 I'm working on displaying a set of images, then if the users wishes, to have the ability to save the image to the SD card. I need help saving them to external storage. Can someone help me out with this? Grid View: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); gridview.setOnItemClickListener(new OnItemClickListener() {

Storing a dict with np.savez gives unexpected result?

半腔热情 提交于 2019-11-30 17:59:21
Can I store a dictionary using np.savez? The results are surprising (to me at least) and I cannot find a way to get my data back by key. In [1]: a = {'0': {'A': array([1,2,3]), 'B': array([4,5,6])}} In [2]: a Out[2]: {'0': {'A': array([1, 2, 3]), 'B': array([4, 5, 6])}} In [3]: np.savez('model.npz', **a) In [4]: a = np.load('model.npz') In [5]: a Out[5]: <numpy.lib.npyio.NpzFile at 0x7fc9f8acaad0> In [6]: a['0'] Out[6]: array({'B': array([4, 5, 6]), 'A': array([1, 2, 3])}, dtype=object) In [7]: a['0']['B'] --------------------------------------------------------------------------- ValueError

Stopping product saving process in observer

有些话、适合烂在心里 提交于 2019-11-30 17:18:04
问题 I am currently developing a module working with the product edit in the backend. Its purpose is to retrieve categories the product belongs to and populate an attribute (the Brand attribute) with the list of selected categories. It is mandatory for the admin to select at least one category. My module works as expected except that I don't know how to stop the saving process if the admin hasn't selected any category while editing a product. Here is the workflow Administrator selects categories

Magento custom model won't allow DB table changes

爷,独闯天下 提交于 2019-11-30 16:50:22
问题 I've run into an issue with a custom Magento module I've created. In short, I created a simple module for customer uploads on the front-end. I created a new table with some generic fields like 'project_id', 'title', etc. This is all fine...I can set model variables and save them to my table using model->save();. Just now I have the need to add a new field or change an old field's name around. For a reason that I can't understand new fields and changed fields will not get stored to via model-

Storing and retrieving data from sqlite database

依然范特西╮ 提交于 2019-11-30 16:38:19
I am building an app which contains a form in one view,in which the user fills all the fields and when he clicks the save button the data must be saved in to database and after navigating back,there's another view which, when entered, must show the saved data(event). I have created a database and have gone through several sqlite3 tutorials; I have done all other changes to my code according to my requirement. However, when I use this statement to check whether data is inserted in database: SELECT * FROM reminders; I am getting nothing and I am confused whether data is inserted or not. How do I