TextMate brackets insertion - ruby-on-rails

Please note that I did ask this on Super User and received absolutely no responses, so I decided to port this to a programming community that knows a lot more about TextMate.
Working in Ruby on Rails in TextMate, when I select a chunk of text, let's say
My text
and then hit the open bracket [ key on my keyboard, TextMate wraps the selected block in opening and closing brackets, as such:
[My text]
I'd like to modify this behavior so it wraps it in an opening bracket, space, space, closing bracket, as such:
[ My text ]
(mind the spaces).
How would I go about modifying this behavior?
I don't mind modifying it only while working for Ruby on Rails (i.e. .rb, .html.erb file scope etc...) but I'd prefer it if it would take effect throughout the application.
Thank you!

Well i hope this is better than no answer. THe behaviour is controlled by a bundle. So you edit the respective bundle to get the behaviour you require.
Here is a quote "Some of the default items may not be to your exact liking, for example the coding style in snippets may differ from yours, so you may want other tab triggers, key equivalents, or similar modifications.
If you edit a default item the difference will be stored in ~/Library/Application Support/TextMate/Bundles. These are then merged with the default version so your changes will be effective even after upgrading TextMate. All new items you create also end up in this location.
Bundles or bundle items which you install by dragging them to TextMate or double clicking will be installed in ~/Library/Application Support/TextMate/Pristine Copy/Bundles. Editing these will also result in only the differences being stored in ~/Library/Application Support/TextMate/Bundles, meaning that if you later get a new version of this third party bundle, you can safely install this one on top of the old one (by dragging it to TextMate) and again your changes will be preserved.
If you want to discard local changes then currently the only option is to delete these from ~/Library/Application Support/TextMate/Bundles."
Fo more pointers go here. Hope this helps.

Related

In PHPstorm , is any way to avoid save all open documents instead current active document? [duplicate]

My traditional workflow must be a little different to the PHPStorm default. I often work on multiple files at the same time and want to be able to save just one file when I've finished with it, without saving the others that I've modified.
I've managed to turn off the auto-save feature. Now, when I edit files I get stars on the ones I've edited and they stay like that until I hit 'save'. So far so good.
But when press CTRL-S to save, expecting it to save the one file I'm looking at so I can go back to the ones with asterisks to polish them off too, it also saves ALL the other files too.
I hope there's some way to change this behaviour or set up something to allow me to save just one file at a time!
Yes, you can .. but that still does not change a lot (e.g if you change your settings, or run/re-run something -- all files will be saved automatically anyway). Eventually (after few weeks or month of adaptation) you will get used to this behaviour and quite likely will love it (yes, this means changing working habits a bit, which is quite hard to do (requires time) for some people/in some cases).
Anyway ... to enable "save single file" functionality:
Settings | Keymap
On that screen, in search box type "save"
The action you are after is called "Other | Save Document"
Assign whatever shortcut you want.
P.S.
This action will NOT ask for confirmation (same behaviour as standard save does).
P.P.S.
This action is available since PhpStorm v7 ONLY.

RubyMine searching with find usages

I have just bought a license to use Ruby Mine and am really struggling to learn how to use it. I keep having to go back to Text Mate to do simple things like searching.
I'm trying to find where i have defined a css div (called "category title"). From what I can gather, I need to use 'Find Usages' in Ruby Mine. Most times when I go to the edit/find menu, 'find usages' is greyed out. Then, if I click on the uppermost 'app' folder, and click find usages, it searches for 'app'. It doesn't recognise the search in the search bar. If i type the div name in the code and click alt/F7, it gives me a typo warning rather than a search option.
Does anyone know how to search the entire app (not just the specific file of the app) in RubyMine? I'm finding this incredibly frustrating.
Thank you
The command you need is Find in Path which will search your entire project, set of projects if they are open together, a specific director, etc. It has a bunch of options, including a regex search. For Mac, it is Command+Shift+f, for windows Ctrl+Shift+f
Checkout this site for keyboard reference.
https://www.jetbrains.com/ruby/documentation/index.html
You might also try shift+shift which is search everywhere, files, classes, symbols.

iOS: Deleting localized string files in an update

I have an application in the App Store with the string files localized. The thing is I want to submit an update with the string files only in english,but when I install the app from xcode(only with the string files in english) in a device that has already the application installed(from the App Store) I can see the strings in other languages than english.
If I install the app in a device without the application already installed I can only see the strings in english,regardless the selected language on the device.
I know one option is to change the name of the string files,but I was wondering if there is a smarter way of doing this.
Thanks a lot
The problem is likely that your old localised.strings file is still hanging around in a different location. When you add or change languages using localisation, the strings file may be moved to a different folder. When the delta update occurs it obtains the new strings file, but fails to delete the old one because it's in a different location. However that location is higher up the search tree, and so gets found first when the app looks for a string.
One potential solution, though not a nice one, is to rename your localized.strings file to something different, then use the localizedStringFromTable command in all places you previously used localizedString, naming your new file as the table of origin. It's not a pretty fix, but it should work.
Another potential solution if you only need one language is to ensure that the strings file is stored in exactly the same bundle location as the one in the previous version.
I solved the problem with this line in the file main.m, right before calling to UIApplicationMain():
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObject:#"en"] forKey:#"AppleLanguages"];
Basically it forces the app to be available in English only.

how to temporary use a font with the same name as a local registered one (in "use")

I know how to register+notify and unregister+notify a font using Delphi.
But I want to know what can I do when I have a font which has a similar name with a already registered font (but it's a different version). Maybe even in "use".
I can try one of these:
Use the font just locally in the program (but in some situations I don't have access to code because I didn't make it);
Somehow temporary unregister the local one (even if it was in "use"), use the new one as long the program is open and reregister the local one after the program is closed.
I would prefer the first but I'm not sure 100% that it can be done (I never heard of a font used locally in a normal Windows program but I asked just in case I'm wrong).
And I don't know if it's ok to forcibly unregister fonts in "use" (if it's possible).
But maybe someone has a better idea...
Thank you.
What about telling the user he has an old version of the same font installed, and new versions needs to be installed so he can experience the new glyphs.
You can even do that in the installer for your program; that's what installers are for: people expect things to change/improve when running installers :)
Edit:
If you don't have an installer, then make it clear to the user that he has two options:
have it let your app install the updated fotn
don't see all the characters
Applications that change entire system settings for their own purposes, even if temporary, are typically looked at in a negative way.
Say you remove a font, then change it to yours, then your program ends/crashes before the original is restored.
Sounds like you have a variant font you want to use for your application that already uses a name
that may be found on the system.
I personally would change the name of your new font to something unique enough that it won't conflict with existing fonts. That way you can use your font without affecting other applications.
Updated:
Since you can't change the name of the font. I would follow Jeroen Pluimers Recommendation of asking if the user wishes to upgrade. This does not need to be done in an installer, it could be done from the application on start up. But asking the user is far better than doing it silently.
Use font locally - bordering on the impossible
Your point "1" should be possible (use a given font only locally) because Web Browsers do it. The #font-face CSS directive can be used in a way to ignore the locally installed fonts. But I suspect doing this the web-browser way is difficult: I didn't see any way to CreateFont using a TTF file. I suspect web browser do it by re-implementing the whole text rendering engine. This is very likely because they usually support more then one type of font files.
If you do get this to work, it's not going to work with standard API's. You're not going to set the Font property on a label and automatically get it to render using the given "local" font. You're definitively not going to get this working with an unmodified application.
Replace Windows font - very bad idea
Unfortunately, as Robert mentions, this is not something you should do. If the user happens to have a font with the exact name of your font, what makes you think yours is better? In this unlikely case you should use whatever the user has, and blame it on the user if the user installed a bad font.
Possible solutions
Use images in place of the special-typography text. Works for small amounts of fixed font size text.
Put your text into a TWebBrowser and style it with CSS to use your local, alternative font.

The ethics of using 'My Documents' as a dumping ground [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Something I've wondered about for a while now and would like to get a general opinion on:
Advanced apologies if this has been asked previously, I did a search and couldn't find anything similar. This question is related to questions like, "Correct location to save a temporary file in Windows?" , but not quite the same.
I've noticed over the years spent with Windows, from XP to Vista and now to 7, that the 'My Documents' directory has slowly turned from being a place where you're encouraged to place personal 'stuff' into a dumping ground for any junk any random application wants to store.
For example, if I look now at the 'My Documents' directory on my work xp machine, there are folders for Adobe, FX Composer, Maya, Processing, Visual Studio 2005/2008, Visual Studio Samples, Window Clippings, Evernote.... the list goes on and on.
In fact, the last thing that I'd ever use that folder for now is storing my 'stuff' - the very thing it was intended to do. I personally find storing my actual documents in there, along with these random application settings too disorganized and painful to sort through. Plus there are added headaches with backup software etc... The signal to noise ratio just becomes appalling.
Lamenting aside, I now find myself in the position of writing some code where I want to store some settings related to my application. These settings ideally should be 'global' (our software gets regular updates), so storing them in some Program Files directory that's likely to be ephemeral won't work. While settings themselves could be stored in the registry, what about backup files, compressed archives, samples, etc etc...
So really what I'm asking is, what's the right solution for this situation? Do I follow the crowd and use 'My Documents' as a dumping ground? Is that folder a write-off anyway, or am I adding to the problem?
Do you use 'My Documents' as a storage area for your applications? Do you share my frustration with all the junk that turns up in there?
The users of my software are semi-tech-savy, so would probably understand it's just a directory like any other (and so could handle it being elsewhere) - but I guess Aunt Edna isn't going to understand that, so does the answer depend on context?
Thanks in advance!
Edit:
Thanks for the suggestion of %APPDATA% - I guess this is fine for application settings and files that shouldn't be exposed to the user, but what about files that might be useful for the user to move/manage themselves? Is My Documents the only solution or should I still stick to %APPDATA% ?
If these are application-private files (i.e. not user-visible documents) then isn't this what the %APPDATA% folder is for?
Just make this configurable at install time, and later by the user. Ideally give them just two choices, one being My Documents and one being APPDATA.
Make APPDATA the default but do allow this to be easily changed at install time for enterprise admins who want everything in the My Documents folder which is automatically archived.
Not a good idea as a 'dumping ground', but it simplifies backup, for a start.
In my workplace, users' My Documents folders are all on a network drive for ease of capture by an automatic backup system.
Just because applications are dumping stuff into "My Documents" doesn't mean they should. At the very least, if you need to dump things there, then make the folders hidden. Really, you should use %APPDATA%.
I'd say that Application Data is the place to keep settings etc., whilst My Documents (possibly in an application-specific sub-folder) would be the default place to keep output data files produced by your application.
Having the latter configurable via your installer / application settings dialog would be the nicest all-round solution.
How about following the unix/linux tradition of storing it under ~/.app_name? Just make sure it's hidden, and ~ could be the "My Documents" folder
In any of your library windows ( documents music video etc... )
just click the locations menu ( on the left side of your document pane's menu opposite the right side of the pane which contains the other menu: the folder drop down menu, for folder types )
it will be called locations or if you already have more than 1 location the menu will be called: Includes: n locations.
Just click that location menu and you can add as many document directories you want.
You can change the order so your specified directory is the primary viewed documents folder. ( And you can choose the default save folder to be the original folder. applications then dumped to the original default location, leaving your primary location pristine )
However in some navigation windows all the locations are viewed together as one huge documents folder.
( although messy you do have the advantage of navigating all those locations at one... so I suppose those search window prompts make sense? )
You can set a system env so that Maya will use your clean primary custom documents location instead of the default save location.
in the system properties control panel's advanced tab:
create/or edit a system variable for...
MAYA_APP_DIR
E:\myCustomDocs\Maya
( I use a different fast hard drive to save on my SSD system space. )
For added flexibility look up setup of hard link soft links and symbolic links!
where directory pointing as simple as:
mklink /J [old location] new location
Gives you alot more options and power!
Hope that helps?

Resources