C-ISAM file consistency - informix

INFORMIX-SE 4.10.DD6: I seem to be having spurious problems like missing pointers with C-ISAM files in my SE database. When I do 'bcheck -y FILE_123' it says it has rebuilt indexes and fixed the problem, but when I re-run bcheck on it again, it repeats the same error messages and says it fixed it, but not true! I know this is an unsupported/outdated version of SE, but if you can think of any other alternative to fixing this other than unloading/dropping table/re-create and load back in, I would appreciate any help. When I used SE 2.10.06, bcheck worked fine, but since moving up to 4.10, C-ISAM files and bcheck have been problematic.

There's the old trick of:
Create a new table with the same index structure as the table that is giving trouble.
Copy the (almost empty) index file for the new table over the index file of the old one.
Rerun bcheck.
Of course, you take precautions:
You create the new table.
You copy the data file of the troublesome index file somewhere.
You copy the new index file beside it.
Run bcheck on the new copies.
Rerun bcheck on the rebuilt file.
Only copy stuff over the database copy if everything looks OK.

Related

How to replace an entire file using FileManager

Let's say I have an UIImage cached in my Cache folder:
/.../Cache/Image Cache/<firstImage.id>
Now I want this folder to only ever have 10 image cached at a time, so if a new one comes in I want to take a file and replace the entire file and not just the contents of it. I.e.
/.../Cache/Image Cache/<firstImage.id> becomes
/.../Cache/Image Cache/<secondImage.id>.
As far as I can tell, replaceItem(at:withItemAt:backupItemName:options: only replaces the contents of the file but the file name remains the same. And I'm not too sure what replaceItem(at:withItemAt:backupItemName:options:resultingItemURL:) does even though it might be what I'm looking for (I don't know what an AutoreleasingUnsafeMutablePointer<NSURL?>? was but it sounded dangerous so I decided to leave it alone, specially since it has the word "unsafe" in it).
Is there a straightforward way of doing using an in-built function or is manually deleting the old file and adding the new file the best way? Please let me know.
Thanks in advance!

Simple storage not persisting data between sessions

I'm trying to use the simplestorage from my extension, but I can't retrieve values between browser sessions. Here's the thing: From my main code, I created a value this way:
var ss = require("sdk/simple-storage");
ss.storage.foo = [{id:"bar1", properties:{a:"aaa", b:"bbb"}}]
console.log(ss.storage.foo);
This is ok, I coud see the object through the log. But then I closed the browser, commented the "foo definition" (line 2) and the console log was "undefined".
I know cfx run by default uses a fresh profile each time it runs, so simple storage won't persist from one run to the next. But I'm using
cfx -b firefox run --profiledir=$HOME/.mozilla/firefox/nightly.ext-dev
So I'm sure I'm using the same profile everytime.
What could be happening? What am I missing? Any idea is welcome! Thanks in advance!
Thanks to the answer of Notidart, I could discover that the problem was the file is saved when you close Firefox in the right way. When you just kill it through console, it's not persisting data.
This is how simple storage works. It creates a folder in your ProfD folder which is your profile directory: https://github.com/mozilla/addon-sdk/blob/master/lib/sdk/simple-storage.js#L188
let storeFile = Cc["#mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties).
get("ProfD", Ci.nsIFile);
storeFile.append(JETPACK_DIR_BASENAME);
storeFile.append(jpSelf.id);
storeFile.append("simple-storage");
file.mkpath(storeFile.path);
storeFile.append("store.json");
return storeFile.path;
The exact location of the file made is in a your profile folder, in a folder named jetpack then your addon id, then a folder called simple-storage, then in a file in that folder called store.json. Example path:
ProfD/jetpack/addon-id/simple-storage/store.json
It then writes data to that file. Every time your profile folder is recreated (due to the nature of temp profile, due to jpm / cfx), your data is erased.
You should just use OS.File to create your own file to save data. OS.File is better way then nsIFile which is what simple-storage does. Save it outside that ProfD folder, so but make sure to remove it on uninstall of your addon otherwise you pollute your users computers
Just in case someone else finds this question while using jpm, note that --profiledir is removed from jpm, so to make jpm run using the same profile directory (and thereby the same simple-storage data), you have to run it with the --profile option pointing at the profile path - not the profile name.
jpm run --profile path/to/profile
For future readers, an alternative to #Noitidart's recommendation of using OS.File, is to use the Low-Level API io/file
You can create a file using fileIO.open(path). If the file doesn't exist, it will be created. You can read and write by including the second argument fileIO.open(path, mode).
The mode can be:
r - Read-only mode
w - Write-only Mode
b - Binary mode
It defaults to r. You can use this to read and write to a file (obviously the file cannot be in the ProfD folder or it will get removed each time jpm / cfx is run)

Process Task - Unzipping files is failing

I am using sql 2012 SSIS process task to unzip my files but I am getting the following error
[Execute Process Task] Error:
In Executing "C:\Windows\System32\compact.exe" "x F:\Imports\RenLearn\'Roseville City School District'.zip -oF:\Imports\RenLearn\Roseville City School District" at "",
The process exit code was "1" while the expected was "0".
The two paths above are created as variables along with the path to . Any suggestions and thanks ahead of time.
I had the exact same problem and I realised that I had copied the .exe file in the same folder as the .zip files because this resolved my problem in BIDS, but in Data Tools it seems like necessary to do that.. sounds little weird, but it worked for me so perhaps it will for you as well. :-)
If you have set the "Working directory" property, you need to remove it to make the task work.
Remove the space in zip file name as the Execute process fails if the file contains special characters. Instead of spaces, use "_" and try it. Even the same issue I got later was sorted out by this approach.

Existence of .inputrc breaks paste shortcut

I recently created an .inputrc file in the root directory of my Windows (Vista) user, to override the default history behavior. Today I realized that the 'Insert' key doesn't work for pasting text any more - a tilde character is pasted instead. I found out that this is caused by the .inputrc file being there (an empty file is sufficient). Without the file, insert works just fine.
I tried to restore the insert behavior in the inputrc file, but I don't understand it well enough to make it work. I'm not even sure if I have to override "\e[1~", "\e[2~", or if I have to set some other variable.
Any ideas on how to use both 'Insert' for pasting and .inputrc?
Adding the line
"\e[2~": paste-from-clipboard
to your .inputrc should do it, see How can I copy and paste into Cygwin console windows? You'll probably also need mappings for the Home, End and Delete keys as show under Why don't the Home and End keys work in rxvt and vim?

Erlang : Mnesia : Is it safe to remove files with prefix _fs?

I have a couple of files in mnesia directory, like
fs_my#node_14585_1263_545605_962084.273
fs_my#node_14702_1263_545842_879762.273
fs_my#node_14585_1263_545605_962084.290
...
Can I remove them (because it is big files) without risk to lose data?
Why does these files apear?
What are these files for?
Is it safe to remove them?
See http://www.erlang.org/doc/man/file_sorter.html
So without looking into the files, I would say that
1.+4. Yes, you can remove them, but first give it a try, as Zed said.
2.+3. They are temporary files used for sorting and should have been removed. """[...] Temporary files are deleted unless some uncaught EXIT signal occurs."""

Resources