What is called a language-country prefix like "en-US"? - locale

I looking for the proper name for the en-US, pt-BR, etc thing.
I tried searching for a few terms, I've found "LCID" but it seems to be a Windows/Microsoft universe thing.
I'm looking for a better term to describe it, but I'm not quite satisfied with:
localeCode
localeSlug
the language-LOCALE [a-z]{2}-[A-Z]{2} pattern seems to be used everywhere, so I want to refer to it with a name that implies the format.

That specific format is the IETF language tag. https://www.rfc-editor.org/rfc/rfc5646
You could more generally call it a "language code" or "language tag".

Related

Language Server Protocol: find all methods

I am exploring LSP to get a feel for what it can do. Most things are pretty obvious, completion, find references, etc. I've been told that LSP will allow me to find all functions/methods in a given language but I've yet to figure out how that might be possible. After much searching and doing some investigations with a few languages in Emacs, I am starting to doubt that it is even possible. Am I missing something? Is it possible with a given LSP instance to find all methods by file, line and column location?
You would use the workspace symbol functionality. If you look in the "vscode-languageserver-protocol project, it says:
/**
A request to list project-wide symbols matching the query string given
by the WorkspaceSymbolParams. The response is
of type SymbolInformation[] or a Thenable that
resolves to such.
*/
LSP Documentation on Workspace
If you're using a client, you'd find the method that calls that. In the project I'm trying to do, using the Brackets.io client, the method is
client.requestSymbolsForDocument
for example. If you're writing your own client, then you'd implement the appropriate method. You may get some extra help here. For all functions in the current document, then look at document symbols.
That's about as I know, I'm also learning.
Good luck.
Sethmo

Changing the text on a label in different languages

Not really that easy question here. :)
A customer has a field ownerid that is used as the lookup to a salesperson. I've changed the text of the label from Owner to Hazaa and I can see it take effect.
The problem is that Hazaa only displays in the English version (the base language of the installtion), while the language that is used for the users is Swedish. The users with Swedish language selected see the default translation, while they'd like to see Hazaa instead.
How can this be done?!
I could, perhaps, play around with exporting the language for translation, editing it and, then, importing back. However, that's a little, tiny, wimsy bit overkill for changing a single label. However, I suspect that only a few entities will require hazaa-fication of the ownerid field, while the rest is supposed to be left as is.
The supported way to translate the label is using the translation process (an example can be found here)
Maybe you can consider to create an unmanaged solution that contains only that entity, in order to export only the necessary labels.
There is also a tool recently released by Tanguy Touzard in his toolbox, I didn't use it yet, but you can find more information here:
http://mscrmtools.blogspot.com/2013/08/new-xrmtoolbox-plugin-easy-translator.html

Yesod 1.2 Authorization

I'm working on a Yesod-based website. I had been reading the Yesod book online, and I ran into an inconvenient discrepancy (Yes, I know the book is out of date). Usually I can just Google around these discrepancies, but I don't know where to start.
In particular, I'm trying to set up authorization for some routes. The Yesod book says I should define
instance YesodAuth MyApp where
isAuthorized RouteR _ = <check for stuff and return an authorization token>
But that method is not defined in Yesod.Auth.YesodAuth anymore. What is the current state of the craft?
I see you already found the answer, but in the future, you may be able to find it more quickly by using a more specialized tool than Google. Probably the best Haskell API search engine for Yesod is this one: FPComplete's Hoogle Search.
There's also the Haskell.org Hoogle Search
And Holumbus's Hayoo Search, at least when it is up. It's down as I'm typing this, but it should return at some point.
Both the Hoogle and Hayoo allow you to search both on function/package names as well as on function signatures, so if you know what the function you want does but not what it's called you can still search for it! They do vary a bit on how they interpret the type you give them and what packages they search by default, so you may want to keep both links handy and try queries on both.
Note that the FPComplete Hoogle searches in all of the packages it indexes by default, while the main Haskell.org one will only search in Haskell Platform packages by default, but will also search in other packages on Hackage if you explicitly ask it to by adding +<package name> to your query string, e.g. isAuthorized +yesod-core for your question.
Based on this haskell-cafe thread the Haskell.org Hoogle search engine will probably have this restriction lifted at some point, but meanwhile you should probably use one of the alternatives I listed if you don't know the package name and you don't think what you're searching for is in the Haskell Platform.
Finally, you can download the hoogle code from Hackage (via cabal install) and it will give you a local package index that you can query from the command line or integrate into an editor. This can be pretty handy for quick look-up of a function that you know exists in the Platform but you can't quite remember the details of.
Okay, I found the method. It is in the Yesod type class now.

unistd.h implementation

My toolchain (Realview) does not have implementation of unistd.h, I have a code that I need to use that is using unistd.h, some function like access, open.
So I need to implement this functions by myself.
My question is, is there another alternative or some reference (except the function description, found here) that I can use in order to port/implement these functions?
What is the correct way to do that? It's my first time posting.
The "function description" you link to has the page title "The Open Group Base Specifications Issue 6", which indicates that it's perhaps a bit more of a heavy-weight than just being a mere description.
If you implement a function that fulfills all the text on that page correctly, chances are you've managed to re-implement it in a compatible way, so that programs complying to the same standard will build and work.
Not sure what else you feel you would need.

VS2010 modify intellisense popup order via an addin?

Is it possible to modify the order of the intellisense options shown when I hit ctrl-space?
Specifically, I'd like to order them in scope, so that if I have a variable in my function that matches what I've typed so far then it goes to the top of the list. If there's a member in the class, that's next, etc. I'm just kind of sick of having to type enough that I don't match some random global symbol in Windows' crypto libraries or whatever.
Is this kind of this possible? Where do I start? I looked for an obvious option in vs2010, but didn't find anything.
My programming language is native c++.
Here's what I've found so far.
A walkthrough showing how to add items to the intellisense popup: http://msdn.microsoft.com/en-us/library/ee372314.aspx
The walkthrough uses the ICompletionSession interface:
http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.language.intellisense.icompletionsession.aspx
It looks as if you might be able to clear the CompletionSets, and replace them with your own completion sets, but I'm not sure if there's any way to change the order, or if they are always sorted. There is the IIntellisensePresenter interface, but it looks like it's pretty much empty.
Also, from the walkthrough, it looks like you can fill the CompletionSets with a dumb list of strings, so you'd need some other way of interrogating the symbols to determine scope, which may not always be possible.
In short: Probably not possible at the moment.

Resources