How does my computer know to assign a certain image to .doc files? - ms-word

Is the icon file for .doc and .docx built-in to Windows, Mac, and Linux because it's so common? Or would the OS only know to associate that extension with the icon image IF Microsoft word/office was installed, which gave the image file to the OS and instructed it to make the association?
I didn't know how to search for this. I also didn't know whether to ask on Superuser, SO, or Programmers.SE.

For windows, when an application is installed, it registers with the OS what file extension it has for the files. So when you install Office or MS Word, it will tell the OS that it's files can be .doc or .docx and what icon to use for those. Then when any files that have that extension are shown, it will open up in that program. It stores the info in the registry.
If you try to open a .docx file that is not registered, meaning Office not installed, it will ask you to choose a program to launch it with, because it doesn't recognize the file.
You can also manually associate files as well to a specific program if it is not registered.
Most of the time, the associations are done when the said application is installed.
Some operating systems such as Mac and Linux can associate files with their mime type e.g. text/plain. That way it would know to use a text editor to open the file.
You can read a little more detail here about file associations.
http://en.wikipedia.org/wiki/File_association

In windows vista/7, go to your control panel, and search for 'assoc'. Under folder options it has a option labeled 'change the file type associated with a file extension'. This will give you a list of all of the files extension (what comes after the '.') and what program/icon they use.
Most programs create these extensions when they are installed. Some very common formats, like .html, will have association made on any modern system.
Files also get associated when you tell the system which program to use to open a type of file. The icon that type of file uses is usually just the icon associated with the program in that case.
Hope that answers your question.

Related

Unity "player preferences" file format and contents

Upon quitting my application, I use PlayerPrefs.Save() to save the player preferences.
I understand this function writes all the modified preferences to disk.
So, I clicked on Start, typed regedit and opened it, went into HKEY_CURRENT_USER and then Software and then I selected Unity.
So, now I can see the file (is this actually a file?) but I cannot figure out how to open it or see the contents...
Neither double-clicking on it works nor right-clicking on it brings up any menu with options.
How do I access the contents, or perhaps clear/flush it after a while?
You find the PlayerPrefs under:
HKEY_CURRENT_USER/SOFTWARE/[NAME OF THE COMPANY YOU SPECIFIED IN PLAYESETTINGS]/[PRODUCTNAME YOU SPECIFIED IN PLAYERSETTINGS]
If you had checked unity's documentation it is very well explained for each platform here
The exact storage of PlayerPrefs depends on the platform. For Windows it is stored in the registry, as you have seen.
This is not an isolated file for your Unity game. As such, there is nothing really to open. You could edit the registry if you wanted to, but that's not really the appropriate way. Just keep using it via the provided PlayerPrefs API.
If you want to clear your playerprefs, you can call PlayerPrefs.DeleteAll(). This will clear all playerprefs data and would allow you to "simulate" a new user starting from scratch for example.
For Win32 and Win64 builds it is in a Registry file editable from the registry.
In OS X builds it is in a plist file in ~/Library/Preferences These are in plist compliant format and can be edited in the standard OS X plist editor, or a text editor if you follow proper syntax.
In Windows Store builds it is in %userprofile%\AppData\Local\Packages[ProductPackageId]>\LocalState\playerprefs.dat (I don't know the format of this.)
Windows Phone builds store it in the application's local folder, again no documentation on format.
Android and Linux are in xml format, editable with a standard text editor.
The Android config files are package's shared prefs directory and the Linux config files are under ~/.config/.unity3d

bin file in eclipse or notepad

Whenever I tried to open the .bin file in Windows, (and also eclipse), it is like this, so I cannot read anything. I am using it to test Buffer Pool, but I cannot read, so I cannot know that is the test was successful or not. It is same when I opened it wil notepad.
I am using U.S. window, but installed Korean language, but I still can read/write English well.
Extension of file name ".bin" stands for "BINARY". That means your file may contain not-printable characters as you saw.
If you want to see the contenst of binary files, you should use 'Hexadecimal Editor', 'hex editor' in short, instead of text editor like notepad.
http://en.wikipedia.org/wiki/Comparison_of_hex_editors shows many hex editors.
Some software may be able to handle your .bin files. It depends that the origin of that file.

Netbeans file cannot be safely opened

I get files from friend who don't use netbeans IDE, when i open file that contain special caracter like 'é','à',... it show me this popup message :
if i say yes it open the file and changes those caracters to '�' like or
Any idea how to open the file safely?
The letters you are mentioning seem to be French. You need to open the file, specifying the original encoding, then save the file as UTF-8
I recently encountered a very similar problem (I have some javascript files in Chinese which translated into similar non-human readable text upon re-opening the file in NetBeans).
My OS: Linux Mint (version 17, Cinnamon; Notepad++ not available and gedit did not solve the problem).
Netbeans Version: 8.0.1
However, I was blessed to have found the history feature! I was able to get a former version of my file restored and backed it up immediately.
To access a file's history simply click on the History button found on the left side of the tool bar between the tabs of open files at the top of the IDE and the actual source code. (You can also right click on the file name and selected History -> Show History). Then Double click on a *Timestamp representing a valid version of your file. Just below the table of Timestamps the old 'backup' file and the current 'corrupted' file should appear side-by-side. (You can preview several historical versions of the file until you find one that works best for you; of course, when choosing a file I suggest one which is still usable and has the most current Timestamp associated with it!) ). Right click again on the 'backup' version of your choice -> Revert from History. Click back on the Source button found right next to the History button.
Finally, to change the default encoding, I applied the fix suggested by Sebas and Danny here:
How to change file encoding in NetBeans?
Please note that the path to the netbeans.conf file is different (at least with version 8.0.1 on my Linux machine). The path on my machine was : ~/netbeans-8.0.1/etc/netbeans.conf.
This saved the day for me and I hope it helps someone else out there! Bonne chance.

Creating a file type with new icon

I have a text based file i have given an extension named .val i have also changed its icon by selecting Computer>Open tools>Open folder options>
however though this changes the icon for the extension it only changes it on my computer, I would like to know how I can do this for all machines. even if that means building somthing that needs to be installed, which is fine with me
I wrote a little program awhile ago. The windows registry thing is a mess. Save yourself a lot of time and use this installer package - it has a wizard that will create an install script for you. Navigate to your program, icon, etc. Pretty easy.
http://hmne.sourceforge.net/
As I recall, in windows icons are set based on what program is opening it, so indirectly the file type. So first you have to create reg entries for your application on your computer. Then you have to associate that file type with your extension. And then the extension gets the icon from your app settings. This of course is different in WinXP vs. Win7. Thus why I think you should avoid a lot of headache and use an installer.
[HKEY_CLASSES_ROOT\Your App\DefaultIcon]

Windows: Execute Batch File for a Custom Context Menu Item

I am looking to add a new item in a right click context menu for a certain file type. I suppose it would be easiest to run a batch file with the full path of the file as an argument. I need to rename the file, unzip it, then rezip it, then rename it. I suppose winzip command line would be appropriate tool to help with that, unless someone else has a suggestion.
My questions are:
- How can I add a custom context menu item based on file type
- How can I pass the file name as an argument to the batch file from the context menu
- Finally this may go out to 2-3 people, and it might be easier to simply have an installer that sets this up for them. Anyone know of any free installers that could do this?
Some details about why I am trying to do this:
I have a tool that is zipping things correctly, the program that is reading the zip files is not unzipping to standards it seems. It unzips in winzip legacy mode or something. Rather than fix a working program/investing time or attempt to do some ultra-fancy, crazy fix on a linux server for zipping into winzip legacy format a workaround seemed appropriate for now. These processes only really occur internally, but they are still painful/annoying to do.
7zip is free, you might want to use that if you need to bundle the zip utility
Customizing a Shortcut Menu Using Static Verbs
%1 in the command string in the registry is replaced with the filename
Inno Setup, NSIS or WiX